playMaker

Author Topic: get/set position (etc), world, local & self.  (Read 3716 times)

Sjones

  • Full Member
  • ***
  • Posts: 201
    • View Profile
get/set position (etc), world, local & self.
« on: February 07, 2013, 10:09:47 AM »
all the transform options in playmaker only have world and self.

however the code for the scripts actually uses .localposition so this is a little confusing on its own

so could anyone extend them to have world (move in the worlds x,y,z) local (move in parents x,y,z) and self (its own x,y,z) as a "space" option for things like get position, set position and any others that require an orientation type.

http://docs.unity3d.com/Documentation/ScriptReference/Transform.Translate.html

thats the code for it, however I am unsure of how to integrate this into the existing actions.

thanks

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: get/set position (etc), world, local & self.
« Reply #1 on: February 07, 2013, 12:20:19 PM »
Unless I'm like totally deluded local space is the same as playmaker self space. I can imagine that it was renamed because any non programmer and non 3d artist would have a hard time understanding such abstract terms. But traditionally there is no such thing as self space.
Best,
Sven

Sjones

  • Full Member
  • ***
  • Posts: 201
    • View Profile
Re: get/set position (etc), world, local & self.
« Reply #2 on: February 07, 2013, 12:36:05 PM »
it all down to how you want too call it,
however local space and self space are different, or the way I put it, if its not called self space then what ever you want to call it.

there are 3 different orientations, below is the link to the code for each

World space (PM's world space)
http://docs.unity3d.com/Documentation/ScriptReference/Transform-position.html

Parent Space (denoted by "local" under scripting) (PM's self space)
http://docs.unity3d.com/Documentation/ScriptReference/Transform-localPosition.html

and the third space, where its translated on its own local axis, (this I call self space to separate it in the programming language terms. in my modeling package, and in the unity editor this is called local space, funny huh)
http://docs.unity3d.com/Documentation/ScriptReference/Transform.Translate.html
« Last Edit: February 07, 2013, 12:41:01 PM by Sjones »

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: get/set position (etc), world, local & self.
« Reply #3 on: February 08, 2013, 01:39:26 AM »
World space means it uses the same global axis everywhere. Local space means it regards the axis as if they were part of the game object, so when you rotate the parent then you also rotate the child so the local axis will also change.
I've asked around and there seems to be no default axis for the parent rotation. However, you can use inverse direction transform (or whatever it's called in. Playmaker) and convert a local vector to a world position based on another game object. Then you can use that in a world transform action for example.
An integration of this into actions like translate may b useful, but it ,may also confuse new users, so I dunno if it might be a good thing.
Well, at least now you know how it could be done if wanted to integrate it yourself. Hope it helped and I'm not misunderstanding stuff :-)
Best,
Sven