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 » Scripters
Home Search
 

Re: Gravity/physics question

Previous Thread :: Next Thread 
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 03:59 PM
If any of you have played Mario Kart 8, you would know what I'm talking about. I was wondering how you would make a car stick to a surface while also being able to move normally. Sorry it's such a vague description, I just don't know how else to put it.
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
19 Jan 2016 04:01 PM
You could permanently bind the elevation of the chassis to the roadby using Rays to detect its distance directly below the car, and locking it.


Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 04:02 PM
Do you mean like continuously setting the elevation or is there an instance that will auto set it?
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
19 Jan 2016 04:07 PM
Just a ray that points directly down from the bottom of the car, and ensures that the chassis is always, say 2 studs higher than the surface of the road.

This would require a loop to consistently check the position of the chassis.

You could, instead, create a single part that the entire char is anchored to which ACTUALLY controls the car in a customized way, as opposed to the classic wheels/body/seat mechanism.


Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 04:11 PM
What about the direction? So that if it's upside down, it can check the bottom of the chassis.
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 04:13 PM
Would I check the direction that the part under it is facing, then change the car's direction to it?
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 04:33 PM
Does anyone know how to fix that problem?
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
19 Jan 2016 04:35 PM
You could likewise manipulate the rotation of the chassis, yes, to make sure it never flips over.
I would recommend looking at ROBLOX's skateboards in the catalog. Take out the scripts, and look for the bit where they levitate back up, and correct themselves if they flip.


Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 04:38 PM
And that would make the car look like it's riding on the undersides of parts?
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
19 Jan 2016 04:40 PM
Not necessarily on its own merit, no, but it would prevent flipping.
The raycast would be used in tandem with this to determine distance from the road.


Report Abuse
Lineout is not online. Lineout
Joined: 06 Nov 2012
Total Posts: 684
19 Jan 2016 04:44 PM
I posed this question awhile back

http://forum.roblox.com/Forum/ShowPost.aspx?PostID=181242528
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 04:51 PM
@Lineout What is start position?
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 04:52 PM
Is it the original position of the thruster?
Report Abuse
Lineout is not online. Lineout
Joined: 06 Nov 2012
Total Posts: 684
19 Jan 2016 04:55 PM
Yes
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 05:58 PM
I tried this and it's not working:

while true do
local startPosition = chassis.Position
local ray = Ray.new(chassis.Position, chassis.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * 100)
local ground, hit = workspace:FindPartOnRay(ray, kart)
local newHeight = (hit - startPosition).magnitude
chassis.BodyPosition.Position = Vector3.new(startPosition.X, newHeight, startPosition.Z)
wait()
end

I'm really bad at Vectors and CFraming.
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 05:59 PM
When I used that, the car wasn't even moving.
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
19 Jan 2016 06:32 PM
http://pastebin.com/kqxHsd6z
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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