I want some examples to learn like world.get_pos, world.get_rotatio…
plz give me some examples that can learn me about worlds…
thanks for all
I want some examples to learn like world.get_pos, world.get_rotatio…
plz give me some examples that can learn me about worlds…
thanks for all
go.get_world_position() is for getting the world position of objects and not that relative position when they are parented to another object, there are some cases where you want this such as with IK setups. Otherwise you want to use just go.get_position()
Rotations are a quaternion. And like position you can get the actual rotation and not just the relative rotation with go.get_world_rotation()
Here’s an example to show the differences
WorldRotationTest.zip (3.2 KB)
You can also use euler angles
function init(self)
-- set "player" euler z rotation component to 45 degrees around z.
go.set("player", "euler.z", 45)
local rot = go.get("player", "euler")
-- do something useful
assert(rot.z == 45)
end
thanks @Pkeod, but I did not realize that yet, I am waiting another useful script…
teach me more…
And you can tell me some defold examples that can easily tell me about world…
Read the API. Read all of it a few times over so you know what’s there and available to you.
You can find tons of Defold examples on Github
oh thankx, I will keep it