how would i get a dynamic object to set its angular velocity toward a direction vector (equivale of lookat)
I have code that kinda works but i think the actualy velocity the last parameter of setobjectphysicsangularvelocity needs to be a dot product or something im not sure ?
hence why i ask cos it doesnt behave correctly
car as integer:check as integer:distance# as float
car = CreateVector3(getObjectx(aivehicle.hit),getObjecty(aivehicle.hit),getObjectz(aivehicle.hit))
check =CreateVector3(lpaths[0].nodes[aivehicle.nextCheck.counter].x,lpaths[0].nodes[aivehicle.nextCheck.counter].y,lpaths[0].nodes[aivehicle.nextCheck.counter].z)
distance#= GetVector3Distance( car,check ) //<500
//print(distance#)
if distance#<500
SetObject3DPhysicsAngularVelocity( aivehicle.hit,0,lpaths[0].nodes[aivehicle.nextCheck.counter].y,0,((AIvehicle.velocity.max - AIvehicle.velocity.current) / 40) + (AIvehicle.velocity.current * 1.2) / 25)
endif
Its part of the new ai development that will be used for the ai of cars using a path to follow