# RayCast car tutorial?

years ago , one could find like dozens of interesting tutorials about ray cast cars

I been digging for a week, seems like it has gone from the web

is there a “better”/new/2.0 technique for this ?

anyone could point me to some links ? or even books

thanks

What do you exactly mean by “raycast car”?

Why search all over the web when its all right here in the wiki?
Also check out the link at the bottom of that page

well it does not need to be a car, jsu a simple platform
a triangle would be simpele enough, but I want 4 wheels, a rectangular platform
so if i cast 4 rays from each corners, I can use F=-kx formula to create springs
but I need to figure out a way to figure wich wheel is on the ground and wich wheel is not in cas of non flat ground
(not even talking about inertia, center of mass, lateral drag… dont really need them at first)
back in the days there were a couple of websites talking about that or even making some tutorials
cant find them anymore

ll check it out

yeah, but I dont want to use jme physics (bullet?), too slow
I wanted to find some detailed explanation on how to create a simple system…

allright I found it back
for thosee interested : http://phors.locost7.info/phors01.htm

Good luck creating something faster yourself.

You use the native bullet yes?

didn’t mean any disrespect, to bullet or anything
my game is more a 3D zelda than a complex sport simulation
so if I could simulate little wagon or something… could use the heightmap normal, but I dont want part of the vehicules
or wheels going in the ground when the landscape gets irregular

well bullet that is included with jme, I tried a hundreed spheres rolling on a height map, beeing moved with a random force, it was super slow

JME includes both a java-only and a native version of bullet. The native version is faster.

Whatever approach you go with, 100 spheres rolling around on a height map will be kind of slow. Will you really have 100 wagons rolling around?

Having been down this path once already myself, try to work out the math of how you will make sure the wagon wheels don’t go into the ground. You can even make the math simpler by only using two wheels at first… then if you actually manage to figure that out try adding a third… then a fourth…

A 2D, two wheel simulation, is kind of possible to kludge. I suspect when you add a third dimension that you will find it difficult. It’s complicated figuring out how a wagon should tip and move to solve for some random terrain. This is 50% of what a physics engine does, really.

Physics engine:
50% efficient collision detection
50% collision resolution

“But Paul, what about all of the velocity, inertia stuff?” That code is statistically insignificant in comparison to the rest.

the spheres test was for characters, I thing I used charactercontroller with rigid bodies, back in the day

for the vehicle,a long time ago, I used newtondynamic to have a similar simulation, but I dont like physics engine, they are unpredictable
and even if it works 99% all the time, there was always once the rigid body was going out of wack (event by providing regular time steps), good luck trying to figure out why when the problem only occurs rarely

You might want to test a meshcollisionshape btw, it might be faster than a heightmap (or slower, it depends)

So why are you asking about ray cast cars when you don’t want to use physics oO Casting a ray to determine the terrain height and just putting your car there isn’t exactly complicated…

• I meant I could do ray casting/spring+damp without using bullet
• I just tested the TesHoveringTank, one cant say it is really efficient, the tank en up with its canon toward the ground

telling myself, hey why not giving another try, but I dont really understand how to use native bullet in JME
I also checked JME test project, could not find anything about native JME

So where do you want to get your data for the forces for springs etc. from? You’ll end up implementing your own physics engine which brings me back to my “good luck doing something more efficient than bullet”.

What does the tank “ending up with its cannon towards the ground” have to do with efficiency? In GTA my cars end up on their roof or side as well…

To use native bullet you just have to replace the jbullet libraries with the bullet libraries, see “Application deployment” in the manual. Its described in the post you linked btw… :chimpanzee_rolleyes:

I meant stability, I dont know
from my experience, physics engine are uncontrolable
hence my attempt to make something super simple

I dont pretend I’ll do better than bullet, I was aiming at something more tailored for my needs

but the jmetests use jbullet, not jme3-libraries-physics …?
is there a tutorial on how to use jme3-libraries-physics or jme3-libraries-physics-native ?

There is a reason physics engines can become unstable and you’ll figure it out as you go down your custom solution and have to solve stability issues. I wrote my own physics engine. I’m intimately familiar with this issue.

If all you want to do is plop a wagon on some point then you’ll be fine. As soon as you want to angle and move it so that all four wheels sit on the ground, you are back in the land of potential instability… or really odd behavior.

It’s worth doing it just to know why it happens, I guess.