Help to use simSetObjetPosition/simSetObjetMatrix

Typically: "How do I... ", "How can I... " questions
Post Reply
garrott
Posts: 8
Joined: 01 May 2013, 00:08

Help to use simSetObjetPosition/simSetObjetMatrix

Post by garrott » 22 May 2013, 20:30

Hello:

I have a question about de second parameter of both funtions, that is "number relativeToObjectHandle".
How i use it?

Thaks you, and have a nice day.


P.D. Sorry for my english there is not good

coppelia
Site Admin
Posts: 7396
Joined: 14 Dec 2012, 00:25

Re: Help to use simSetObjetPosition/simSetObjetMatrix

Post by coppelia » 22 May 2013, 20:53

Hello Garrott,

simSetObjectPosition and simSetObjectMatrix and many other commands have that second argument, typically:

simSetObjectPosition(handleOfObject,relativeToObjectHandle,position)
  • If you set relativeToObjectHandle to -1, then the position will be set in an ABSOLUTE manner: the object absolute position will be position.
  • If you set relativeToObjectHandle to the handle of objectY, then the new object position will be at position RELATIVE to the frame of objectY.
This is a convenient way to set the position relative to any other object in the scene without doing complicated transformation. For example, if you want to set the position of objectX same as objectY, you can write:

Code: Select all

position={0,0,0}
simSetObjectPosition(handleOfObjectX,handleOfObjectY,position)
Cheers

garrott
Posts: 8
Joined: 01 May 2013, 00:08

Re: Help to use simSetObjetPosition/simSetObjetMatrix

Post by garrott » 23 May 2013, 03:19

coppelia wrote:Hello Garrott,

simSetObjectPosition and simSetObjectMatrix and many other commands have that second argument, typically:

simSetObjectPosition(handleOfObject,relativeToObjectHandle,position)
  • If you set relativeToObjectHandle to -1, then the position will be set in an ABSOLUTE manner: the object absolute position will be position.
  • If you set relativeToObjectHandle to the handle of objectY, then the new object position will be at position RELATIVE to the frame of objectY.
This is a convenient way to set the position relative to any other object in the scene without doing complicated transformation. For example, if you want to set the position of objectX same as objectY, you can write:

Code: Select all

position={0,0,0}
simSetObjectPosition(handleOfObjectX,handleOfObjectY,position)
Cheers


Thanks for your answer
have a nice day :D

Post Reply