simGetObjectPosition

Report crashes, strange behaviour, or apparent bugs
Post Reply
danielamaria20
Posts: 16
Joined: 09 Mar 2013, 18:10

simGetObjectPosition

Post by danielamaria20 »

The simGet ObjectPosition give really WRONG coordinates. I ask for the position of an object that is static and ALWAYS in the same place and in every second we give me different coordenates. very weird....

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

Re: simGetObjectPosition

Post by coppelia »

Please post some code, otherwise it is impossible to say what is going wrong ;)

Cheers

danielamaria20
Posts: 16
Joined: 09 Mar 2013, 18:10

Re: simGetObjectPosition

Post by danielamaria20 »

Code: Select all

esf=simGetObjectHandle('Sphere')
PosEsf=simGetObjectPosition(esf,-1)

t=PosEsf[1]
simAddStatusbarMessage(t)
I just add a message bar so I could see what was happenning
Did I do something wrong?

thanks

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

Re: simGetObjectPosition

Post by coppelia »

The code looks ok. Very probably you are accessing the wrong object (e.g. not accessing sphere, but maybe sphere#1 which can also be accessed with simGetObjectHandle('sphere')!)

Make sure you understand how object handles are accessed in V-REP. This represents a powerful and convenient way to reuse the same code for copy-and-pasted child scripts, i.e. for copy-and-pasted objects and models.
Make sure to also read this post.

Cheers

Post Reply