|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 19 Jan 2016 04:33 PM |
| Does anyone know how to fix that problem? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 19 Jan 2016 04:51 PM |
| @Lineout What is start position? |
|
|
| Report Abuse |
|
|
|
| 19 Jan 2016 04:52 PM |
| Is it the original position of the thruster? |
|
|
| Report Abuse |
|
|
Lineout
|
  |
| Joined: 06 Nov 2012 |
| Total Posts: 684 |
|
| |
|
|
| 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 |
|
|
|
| 19 Jan 2016 05:59 PM |
| When I used that, the car wasn't even moving. |
|
|
| Report Abuse |
|
|
|
| 19 Jan 2016 06:32 PM |
| http://pastebin.com/kqxHsd6z |
|
|
| Report Abuse |
|
|