## Help to use simSetObjetPosition/simSetObjetMatrix

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

### Help to use simSetObjetPosition/simSetObjetMatrix

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
Posts: 7857
Joined: 14 Dec 2012, 00:25

### Re: Help to use simSetObjetPosition/simSetObjetMatrix

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

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