I have door in my arena, the arena is doors parent object. I want to use HprInterval/hprInterval to open&close the door, but the door doesnt rotate around its origin but around arenas origin(I think). Is there a way to fix it or do I have to clear door from parent object?
edit: btw: What other ways can be used to open/close door? Maybe I can use bone but the interval thing seems like the best solution.
May be you used flatten, which drop door origin and rotation to (0,0,0)?
No, I didnt use flatten if it is not happening automatically.
Simple test. Work as expected.
from direct.showbase.ShowBase import ShowBase
from panda3d.core import *
s1 = loader.loadModel('smiley')
s2 = loader.loadModel('smiley')
s2.setPos(2, 2, 2)
s2.hprInterval(1.0, Vec3(360, 0, 0), Vec3(0, 0, 0)).loop()
s1.hprInterval(2.0, Vec3(360, 0, 0), Vec3(0, 0, 0)).loop()
game = Game()
Hmm. I think that I know why you get this result - try to see to your door hierarhy (door.ls()) - I think, that indeed door geom is parented to something like PandaNode, not directly to your scene
As I said doors are parented to arena, I dont want to unparent them but I guess, I dont have a choice.
Please give me result of door.ls()
Known pipe types:
(all display modules loaded.)
PandaNode Gate1 T:m(pos -0.017151 75.827 -8.80572 scale 0.155413 0.155413 6.3815
CollisionNode Gate1_wall (2 solids) T:m(pos -0.065907 75.8146 -8.78599 hpr 90
-90 90 scale 6.39793) (hidden)
GeomNode (1 geoms: S:(MaterialAttrib TextureAttrib))
edit: and the code im testing:
Looks ok. Parent shouldn’t affect to objects origin. My sample works correctly?
smiley orbits above the other spining smiley
but your example uses 2 eggs, I have doors and arena in 1 egg
doors are doing the same thing as s2.smiley
but s2.smiley orbits bc s1.smiley spins and not bc it has messed up origin, so it is a different thing…
one important thing I forget to mention: arena is parent object and doors child in blender, with unparented objects in blender it works
Ok, I’ll try to make same sample with the single egg.
Btw, for intervals, as I know, you shouldn’t set initial value if you don’t want to change it. You should setup only increment value.
i would prefer to setHpr on the child node and update the hpr angles by my own function.
the result is same becase the object keeps origin of parent, so setting positions is still messed up
so even if I use gate.reparentTo(render) it still has wierd origin
I managed to reproduce the effect. If in blender the origin of parent object is moved to other position than 0,0,0(and scaling of parent object is influencing it too), it will mess up.
edit: the plane should be spinning, not orbiting
Acknowledge the problem. However, it seems that this is my fault in YABEE. I’ll try to sort out the problem.
Ok. I made some changes, try to replace egg_writer.py in <blender_dir>/2.65/scripts/addons/io_scene_egg/yabee_libs to the new version
code.google.com/p/yabee/source/ … _writer.py
are you sure the origin(pivot axis) of the door model is at the pivot of the door?
for example, a vertex on the door has pos of (2,0,0) in a scene, it can be made of
or pivot (1,0,0) + offset(1,0,0)
or pivot (2,0,0) + offset(0,0,0)
when you move the door in a modeler, did you move the pivot with the door polygons?
Well, it is not 100% yet. Look at this: example2
It doesnt change position but hpr is still messy.
Can I see your original blend file?