hi, I’m making a car game, similar to Mario kart where the cars don’t flip. First i try using rigid body with vehicle constrain, it works really good but its like a real car , so if you go too fast and crash with a wall you would probably go up into the air and maybe even flip the car.
I found that using just dynamics with animation would do the trick with a plane ground , but with a ground with bumps and hills, it doesn’t work.
i made some test using 3 empties that have a ray sensor calculate the points where they hit the ground some math vectors and rotations… and i found a way to rotate cars with the ground. The only thing its that its really difficult to put everything so it doesn’t brake, a lot of research and a better script.
So maybe I’m doing all this in vain because somebody have a better idea or even better a Solution :eyebrowlift:.
just in case here is the script
import GameLogic import Blender.Mathutils as mat import math con = GameLogic.getCurrentController() own = con.getOwner() List =objList = GameLogic.getCurrentScene().getObjectList() boxX=List["OBX"] boxY=List["OBY"] boxZ=List["OBZ"] def pointVector(A,B) : ret = [A-B,A-B,A-B] return ret def productoVectorial(B,A) : X = A.y*B.z-A.z*B.y Y = A.x*B.z-A.z*B.x Z = A.x*B.y-A.y*B.x return mat.Vector(X,-Y,Z) def normal(A) : s=math.sqrt(A.x*A.x + A.y*A.y + A.z*A.z) A.x=A.x/s A.y=A.y/s A.z=A.z/s return A vecN1= mat.Vector(pointVector([point1.x,point1.y,point1.z],[point2.x,point2.y,point2.z])) vecN2= mat.Vector(pointVector([point1.x,point1.y,point1.z],[point3.x,point3.y,point3.z])) vecNorm= normal(productoVectorial(vecN1, vecN2)) vec2=normal(vecN1) vec1=normal(productoVectorial(vecN1, vecNorm)) R = own.getOrientation() R01 = R R11 = R R =vecNorm.x R =vecNorm.y R =vecNorm.z R1 = [[vec1.x,vec1.y,vec1.z], [vec2.x,vec2.y,vec2.z],[-vecNorm.x,- vecNorm.y,-vecNorm.z]] own.setOrientation(R1)