generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Strange Behavior far from Center of world?

Previous Thread :: Next Thread 
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
06 Dec 2013 06:51 PM
I tried spawning a vehicle and welding it together at Vector3.new(9000,0,9000), far away from the world center. Even though it spawns and welds together completely fine when it's at Vector3.new(0,0,0), when I try to do it at this distance, the welds become very noticeably offset from one another.

Not only that, but the vehicle's movement script with BodyVelocity works perfectly fine around Vector3.new(0,0,0), but once it is far away from the world origin, it begins behaving strangely (even though the engine is facing one direction and the bodyvelocity.velocity is being set to that direction, it will go in an offset direction, bounce around, etc).

Why is this happening? Is it fixable or is it just the Rx engine?
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
06 Dec 2013 07:05 PM
It may be your welding system doesnt work correctly. Rotating everything slightly, this would explain your problems.
Report Abuse
BetterBe is not online. BetterBe
Joined: 25 Jan 2009
Total Posts: 1034
06 Dec 2013 07:06 PM
perhaps if we saw the script we could tell you
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
06 Dec 2013 07:10 PM
Sure, here's the script, just a normal weld - welds it all to the engine

function weldAllTogether(t)
initpart = somePart
for _,v in pairs(t:GetChildren()) do
if v:IsA("BasePart") and v ~= initpart then
local weld = Instance.new("Weld")
weld.Part0 = initpart
weld.Part1 = v
weld.C0 = initpart.CFrame:inverse()
weld.C1 = v.CFrame:inverse()
weld.Parent = v
initpart = v
end
if v then weldAllTogether(v) end
end
end

-Even if the weld is messed up it wouldn't explain the strange BodyVelocity/movement behavior
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
06 Dec 2013 07:12 PM
To handle bigger numbers, it may be that lua slows down. Anchor the parts of the vehicle by default, then once that part is welded, unanchor it.
Report Abuse
BetterBe is not online. BetterBe
Joined: 25 Jan 2009
Total Posts: 1034
06 Dec 2013 07:13 PM
i suppose you can try making it so it happens at the middle of the world, then moves to the position you want it to.
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
06 Dec 2013 07:14 PM
I did a quick edit to that script before uploading, here's what it actually is (welding each piece to the next in the list):

function weldAllTogether(t)
initpart = somePart
for _,v in pairs(t:GetChildren()) do
if v:IsA("BasePart") then
local weld = Instance.new("Weld")
weld.Part0 = initpart
weld.Part1 = v
weld.C0 = initpart.CFrame:inverse()
weld.C1 = v.CFrame:inverse()
weld.Parent = v
initpart = v
end
if v then weldAllTogether(v) end
end
end

and I also tried it this way (welding all to engine):

function weldAllTogether(t)
initpart = somePart
for _,v in pairs(t:GetChildren()) do
if v:IsA("BasePart") and initpart ~= v then
local weld = Instance.new("Weld")
weld.Part0 = initpart
weld.Part1 = v
weld.C0 = initpart.CFrame:inverse()
weld.C1 = v.CFrame:inverse()
weld.Parent = v
end
if v then weldAllTogether(v) end
end
end
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
06 Dec 2013 07:15 PM
@BetterBe, I did that to solve the welding issue, and it did work, but I'm still curious as to why the problem happened in the first place. (Since it doesn't solve the movement behavior glitch)

@Jetta, yeah the vehicle (all children parts) is anchored when welded and unanchored all parts are welded.

Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
06 Dec 2013 07:27 PM
Just tested welding a vehicle at 9000,0,9000 with no issues. The vehicle welded fine. Next i tested it at 90000,0,90000. It still welded fine, the only issue was that it was on vibrate mode, and some of the thinner, transparent parts were flashing some. But no issues but that.
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
06 Dec 2013 07:35 PM
Could you try doing 9000, 0, -9000?
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
06 Dec 2013 07:36 PM
By the way, this problem didn't happen for me in 'Play Solo' mode, only in Server and online
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
06 Dec 2013 07:39 PM
I'm testing in offline server mode.

At 9000,0,-9000 the vehicle has a tiny bit of vibration, but that stopped after a few seconds. Other then that i notice no problems.
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
06 Dec 2013 07:40 PM
This is a custom vehicle with bodyposition/gyro/velocity, not a car with wheels, by the way - are you rotating around and then going in a straight line? It seemed to me when playing around with it that based on which vector I was facing it would offset my actual movement vector by a certain amount around the Y axis
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
06 Dec 2013 07:53 PM
I was literally making a baseplate at the position, then copying a vehicle from lighting to workspace, then using moveto() to move it to the position, where it is auto-welded. I did not drive it around. The system of driving for the vehicle would be using motors+welds to move/rotate the wheels. Which may not be helpful.
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
07 Dec 2013 09:48 AM
Doesn't really help
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
07 Dec 2013 07:16 PM
Should I make an example place?
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
08 Dec 2013 09:22 AM
I'll do one last bump.
I'm rather surprised no one has found this problem before - surely someone has driven a vehicle at least out to 9000,0,-9000 before? (That is a vehicle with custom bv/bg/bp, not a manual welded one with motors and wheels)
Report Abuse
SymbolumSicarius is not online. SymbolumSicarius
Joined: 23 Jun 2009
Total Posts: 2899
08 Dec 2013 09:36 AM
Happened with me before,
but it was a problem with my BodyVelocity.
Try playing with that.
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
08 Dec 2013 09:49 AM
Finally a helpful answer :) thank you!
That makes sense, since CFrame adjustments were not being offset , so it shouldn't have been a lua/math rounding error.
I'll play around with it a bit - if I can't figure it out do you happen to have an example BV script that will not incur this problem?
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
08 Dec 2013 12:08 PM
Can't seem to find the problem..

local bv = Instance.new("BodyVelocity")
bv.Parent = engine
bv.velocity = Vector3.new(0,0,0)
bv.maxForce = Vector3.new(4.0000e+022, 4.0000e+021, 4.0000e+022)


while true do

bv.velocity = engine.lookVector*10


wait()
end
Report Abuse
SymbolumSicarius is not online. SymbolumSicarius
Joined: 23 Jun 2009
Total Posts: 2899
08 Dec 2013 02:42 PM
Don't use while true do to constantly update it based on the engine
Just do


engine.Changed:connect(function(p)
--code
end)
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
08 Dec 2013 03:00 PM
It isn't only updating based on the engine part, it is also updating based on input values from the user.
What I provided is just the bit that concerns/uses BodyVelocity (and I made a typo, it should be engine.CFrame.lookVector, of course)


Also I'm not sure if .Changed is advised, unless it auto-limits itself to less than 1 event notification per 1/30second, otherwise it will be running the function much more frequently than I would like.
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
09 Dec 2013 02:24 PM
Still happening :(
Report Abuse
xFortunato is not online. xFortunato
Joined: 25 Nov 2010
Total Posts: 865
10 Dec 2013 11:28 AM
Oh well, guess I have to scrap that game
Report Abuse
einsteinK is not online. einsteinK
Joined: 22 May 2011
Total Posts: 1015
10 Dec 2013 11:47 AM
Vector3.new(4.0000e+022, 4.0000e+021, 4.0000e+022)

Isn't this a bit too much?

Also I had a sort of bug when I have more than 50 parts with BP's and BG's.
If I then mcfly/ myself with my admin, the BodyVelocity acts weird.
The Y force of the BV is high enough and the force Y is 0.15 (up or no movement).
Still I was always going down unless pressing spacebar to go up.
After removing all the parts with the BodyPositions it seemed to work again.
(Thuss, a lot of parts with BodyStuff will break each other in big numbers?)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image