Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Rollercoaster track velocity?

Asked by 10 years ago

I am trying to build a roller coaster, but I want the velocity to go in the direction of the track. I have tested it, but I do not go in the right direction. I am using lookVector, but that may not be it. Here is the script.

wait(1) 
script.Parent.Velocity = Vector3.new(0,0,0)
print(script.Parent.CFrame.lookVector)
script.Parent.RotVelocity = script.Parent.CFrame.lookVector*script.Parent.Parent.LSPeed.Value

Thank you, and have a nice day.

2 answers

Log in to vote
2
Answered by
Muoshuu 580 Moderation Voter
10 years ago

The RotVelocity does not help with movement aside from rotation, and lookVector doesn't give you the type of angle you'd want. Try applying the lookVector to Velocity.

Edit: lookVector returns a Unit-Vector rather than a regular Vector3, a Unit-Vector uses direction values between -1 and 1 to signify the direction, for instance, if I were to have a Unit-Vector of (-1,0,0), the direction would be directly to the right of me, (0,1,0) would be upwards. To get a good velocity, you'd need to multiply the unit vector by a set value.

0
Please elaborate what you mean by, "Try applying the lookVector to Velocity." Becasue if you are saying instead of doing RotVelocity, just do Velocity, that was the first thing i tried, and it did the same thing. rollercoaster57 65 — 10y
0
So basically the new script would be just without RotVelocity? rollercoaster57 65 — 10y
Ad
Log in to vote
0
Answered by
vat21s 0
10 years ago

lookVector returns a Grid like this

[1][0][0] [0][1][0] [0][0][1] --Standard brick Orientation

[1][0][0] [0][-1][0] [0][0][1] --Upside-down brick Orientation

it only returns values from -1 to 1 including decimals. This is a fairly decent article on C-Frame and Matrices http://wiki.roblox.com/index.php?title=User:MrNicNac/CFrame_Cheat_Sheet

Answer this question