Leadwerks Game Engine

Leadwerks Game Engine

View Stats:
MKSchmidt 20 Dec, 2023 @ 7:56am
Questions about units
I may be doing something wrong, but when I use SetPosition I am encountering two problems.

1. First it seems to be setting the position of the object *relative* to the original position of the object, rather than simply placing it in the coordinates I put in.

2. It seems to be using a different scale, so if I wanted to move something 100 units on the grid, I would need to put in (0,0,1) instead of (0,0,100).

I am trying to simply change/set the position of the character entity when I load a map. The script works otherwise, it's just not putting the character exactly where I want it to go.

Is there another command like SetPosition that can place an object in an exact position on the grid?
< >
Showing 1-3 of 3 comments
MKSchmidt 20 Dec, 2023 @ 8:42am 
Okay, sorry I figured it out. SetPosition does absolute coordinates, but the units simply need to be divided by 100, as compared to what is shown in the level editor.

So if you wanted to set an object to position 100,100,100 (as it would be shown in the editor) you would need to use self.entity:SetPosition(1,1,1)

This is working for me. But if there is a better way to do it let me know.
The author of this thread has indicated that this post answers the original topic.
Leadwerks Software  [developer] 20 Dec, 2023 @ 8:22pm 
In the editor, units are shown as centimeters
MKSchmidt 21 Dec, 2023 @ 5:49am 
It might be good to add this information somewhere under SetPosition in the documentation. Or include a page on "Units" or something.
< >
Showing 1-3 of 3 comments
Per page: 1530 50