I want to flip my game object once it collides with a wall but am not sure on the syntax for that when using rotation and quarternions. I want to flip the objects rotation using get and set rotations but im not sure what to write. Any ideas?
If you want to flip in the x direction you could try something like
go.set_rotation(vmath.quat_rotation_y(180.0))
There’s also
sprite.set_hflip()
and
sprite.set_vflip()
maybe you’d like it more?
We have a Sprite flipping example in our Example collection.
Here’s a codepad showing how to rotate on the y-axis.
Remember that collision shapes will not rotate automatically. You need to flip them too! Use physics.set_hflip()
and physics.set_vflip()
.