About Store Forum Documentation Contact

 Moving vehical on path Author Message
ronghester
Member

 Post: #1 Moving vehical on path Hi, I am trying to implement a AI for vehical and wondering how can we use path for moving the vehicals ? The angles for the vehical seems to the key but not able to figure out the exact method. Any help in this regards ? Thanks
04-09-2018 10:01 AM
Zervox
Member

 Post: #2 RE: Moving vehical on path This is where steering behaviour comes in, you use a path it's nodes as guidelines and the steering behaviour will be what you use to get the AI vehicle there, this would give it more fluid movement when it comes to turns etc. I figured I would search for a suitable example to show. https://www.youtube.com/watch?v=_XKphuYviE0 (This post was last modified: 04-09-2018 11:58 AM by Zervox.)
04-09-2018 11:56 AM
ronghester
Member

 Post: #3 RE: Moving vehical on path I am very new to the vehical physics ..I was looking for more of a sample code if any one can provide?
04-09-2018 05:09 PM
ronghester
Member

 Post: #4 RE: Moving vehical on path So i looked into the youtube tutorial for Unity and it all boils down to inverseTransformPoint. whats the equivalent of InverseTransformPoint in esenthel ? In unity it looks like this, how to write this in esenthel ? Vector3 pos = transform.InverseTransformPoint(nextWaypoint.position);
04-10-2018 06:41 PM
ronghester
Member

 Post: #5 RE: Moving vehical on path This is what i have so far... Vec forwardVec = vehicle.matrix().orn().z; Vec DesiredDir = nextMovePos - vehicle.pos() ; DesiredDir.normalize(); flt wangle = AbsAngleBetween(forwardVec, DesiredDir); vehicle.angle(wangle); it turns the wheel but after some time it makes a car go into a complete round turn What might be causing that?
04-14-2018 09:32 AM
Esenthel
Administrator

 Post: #6 RE: Moving vehical on path You use absolute angle. Instead you should choose a different function. There are angle functions in 3d space that take an extra vectors for the axis, but you could just convert points to 2d space using Vec.xz and use the 'Angle' function and then 'AngleDelta'
04-14-2018 08:48 PM
ronghester
Member

 Post: #7 RE: Moving vehical on path It seems to be working now but there is a strange shakiness to the car. Please see in attached video. it looks like the wangle variable is 1 (6 to 7 times) and then -1 (6 to 7 times) if printed each frame. Is there any way to stop the shakiness? Updated code : Quote:Vec forwardVec = vehicle.matrix().orn().z; Vec DesiredDir = vehicle.pos() - nextMovePos; DesiredDir.normalize(); flt wangle = AngleBetween(forwardVec.xz(), DesiredDir.xz()); Clamp(wangle, -1, 1); vehicle.angle(wangle).accel(1);
04-18-2018 09:27 AM
 « Next Oldest | Next Newest »