Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Artoo on April 08, 2018, 10:47:54 AM

Title: How to get another object's speed for a gameobject?
Post by: Artoo on April 08, 2018, 10:47:54 AM
Hello,
I'm making a racing game, and I would need a car to get the relative speed of another car in front of it, to determine if it should keep drafting behind it or overtake/avoid slower or stationary cars.

I tried this with a raycast from the front of the car and storing the hit object, but I only get 0m/s from that.

Can anyone help how to properly do this?
Title: Re: How to get another object's speed for a gameobject?
Post by: CookiMonster on April 08, 2018, 12:24:52 PM
Relativ speed is the difference of leading car speed and following car speed. To get the the speed use "get velocity" or do a simple math.