A
A
Alex Blinov2019-07-02 13:13:24
Game development
Alex Blinov, 2019-07-02 13:13:24

How to determine the direction vector of an object when turning?

I rotate an object with:

function endlessRolling(tank1)
  tank1.rotation = 0
  transition.to(tank1, {time=2000, rotation = 360, onComplete = endlessRolling})
end
endlessRolling(tank1)

For movement I want to use setLinearVelocity. The documentation says it has 2 values ​​object:setLinearVelocity( xVelocity, yVelocity ), but I can't figure out which values ​​to use. How to determine the vector where the object is directed in order to use it in the game?
(Sorry for the photo quality)
5d1b2e70bb564509263516.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Blinov, 2019-07-02
@CEPII

Found the answer myself. For anyone interested: https://stackoverflow.com/questions/11343097/coron...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question