Hi!
I wanted to add trails after tires using Hypertrails by @aglitchman , but when I rotate the position of the object with trail model and script that is slightly offset towards the origin of the car - one of the trails is behaving unexpectedly: (the red and blue lines are for debugging - velocity and forward/frontal direction of the car)
You can see above, that one tire trail (left one of the car) behaves precisely, like I would like them to be, so that it’s head position is changed, but the trail is “drawn” on the track and left untouched, but the other one (right one of the car) somehow “translates” the whole trail.
If I removed them both and created again right trail game object first, and then add left game object - the behaviour is the same, but the last created one behaves wrongly.
I have trails in separate game objects:
And I update their position with the simple script:
local function update_trail_positions()
local car_rotation = go.get_rotation("/car")
local car_position = go.get_world_position("/car")
local new_pos_left = car_position + vmath.rotate(car_rotation, TRAIL_LEFT_OFFSET)
local new_pos_right = car_position + vmath.rotate(car_rotation, TRAIL_RIGHT_OFFSET)
go.set_position(new_pos_left, "/trail_left")
go.set_position(new_pos_right, "/trail_right")
end
I don’t want to make them simply child of the car object, because it causes the whole trail to rotate also:
in this configuration:
But maybe I’m doing something wrong?
Properties of the trail scripts are identical, except I named models _left
and _right
: