PDA

View Full Version : Rotate object around mainView?


performlabrit
12-17-2013, 06:32 AM
I'm having a bit of trouble here, with what I think is a simple problem.

I have linked the mainView to a vizShape object hmdBox. This box reflects head position returned by a motion capture system. I move around the viewpoint indirectly, by moving around hmdBox. Now, I want to draw another vizShape object that is attached to HMD box, that I can freely rotate around the mainView or HMDbox using .setEuler, preEuler, or a similar function.

The goal is to define position in polar coordinates in a head-based reference frame, so that when the head changes orientation the object stays in a fixed position in the subject's field of view. I imagine the steps are something like this: set the distance of the object from the mainView/hmdBox using preTrans(), and then define an angular offset from the straight ahead vector (preEuler?).

It is important to maintain the parameters of degrees of angular offset and distance.

I should say that the only behavior I'm able to get is this:
The object rotates in its own reference frame (not relative to the parent)
or
the object rotates in another reference frame (i assume it's the world-based reference frame)

Should I not be linking, but be setting position etc rel-parent? Other strategies?

My thanks in advance,
- gD

performlabrit
12-17-2013, 08:22 AM
TO answer my own question:

The rotation didn't seem to work, so I've achieved my goal by:

- Not linking, but creating vizShapes that are children of the hmdBox node (that is linked to the mainview)

- doing my own trig to calculate position of the object based on offset angle and distance from the mainview.

- Moving the objects with setPosition

It's not the first solution one might try, but it works.

masaki
12-18-2013, 01:30 PM
Have you tried using postEuler to roate the linked child relative to the HMD? preEuler would rotate it relative to the child itself as you reported.

performlabrit
12-19-2013, 06:31 AM
Sure did. It was rotating in an unknown frame of reference - perhaps the world-base frame of ref, but it's unclear.