- Home /
Raycast car rig going up ramps/slopes.
I have a car rig using raycasts instead of wheel colliders but my biggest problem so far is finding the right way to go about having the car go up ramps or slopes. I'm thinking that I would need to tell it to rotate but that opens some problems when at high speeds. What direction should I be heading to do this? I'm grateful for any suggestions.
Could you have additional raycasts which go out the front and back, for this purpose?
I've actually tried that as well. $$anonymous$$y biggest thing is how would the actual car be moved/rotated? I would assume it would need some sort of command telling it to rotate correct?
Well, there are a few things. It all depends on how your car works on the inside! Is it a rigidbody?
No, don't bother. It's a pretty complex problem, and I don't think I'll be able to give you a complete solution. I can give you tips, but you'll have to do the experiments yourself.
haha Gotcha. That's what I prefer anyway. I don't really like being given the answer. Defeats the purpose of problem solving which is one of the reasons I enjoy coding. Frustrating as it may be. haha So would I be literally telling the car to rotate with one of the various rotate commands, torque, move rotation, so forth, when going up ramps and tell it to rotate further until the forward raycast is no longer colliding with the ground? Or do I go about it some other way? Because I've been forcefully rotating it as such but it's too clunky and unresponsive at higher speeds. And I can't figure how a directional force would rotate the car when it's a directional thing. Thank you for your help so far.