Interval relative to self oddity.. (Solved, Could Use Info)

I’m trying to animate a swordswing (through intervals). I haven’t finished the animation, but am having trouble with it already. When I play the animation (on left click), the sword teleports to the point directly below me (I am the parent object, so I assume that is 0,0,0 for the sword, as it is parented to me). It continues to animate after that, but I am confused as to why it teleports down there rather than moving in place as I intended… I assume that setPos intervals aren’t relative to self? How do I make it so? I saw no argument for this in the docs…

The panda had been small due to scaling changes during some of the animation tests, and so that’s why I know that the sword was below me (the camera is as though one was riding the panda). However, I now cannot check this, because the panda is big again. I tried hide()ing the panda and show()ing the sword, but this didn’t work.

Any ideas?

Here’s the animation code:

Note that the posInterval was 10,10,5 when the sword showed up below me.

		#Test Animations for Sword
		self.wpi1=self.weaponm.posInterval(2,Point3(.05,.05,.025),startPos=Point3(0,0,0))
		self.whi1=self.weaponm.hprInterval(2,Point3(-90,0,0),startHpr=Point3(-45,0,0))

		self.swing=Sequence(self.wpi1,self.whi1,name="swing")

It is played through a simple self.swing.start() command in a task for the left click.

I don’t see anything obviously wrong.

Try printing out the sword’s pos after the interval, to see if it is in fact going where the interval is telling it to go.

David

I told it to print, then start the animation, then print again. I went in and clicked a few times.

To me it looks as though it inexplicably teleports from

Point3(-60, -200, 900)
(it’s initial position)

to

Point3(0.0347, 0.0347, 0.01735)

Any idea why?

Ah - the startPos was set to 0,0,0 - and it wasn’t interpreted as relative, so it was teleporting to the origin of the character (below him), which is the sword’s parent, before animating.

I guessed and was right that the startPos/Hpr arg was optional (these things are undocumented damnit!) and set some variables, and this is working. If there is an easier way, let me know though…

Here’s what I’m now using:

		ox=-60
		oy=-200
		oz=900
		oh=-45
		op=0
		orr=0
		self.wpi1=self.weaponm.posInterval(2,Point3(ox+10,oy+10,oz+5))#,startPos=Point3(-60,-200,900))
		self.whi1=self.weaponm.hprInterval(2,Point3(oh+-90,op+10,orr+2))#,startHpr=Point3(-45,0,0))
		self.wpi2=self.weaponm.posInterval(2,Point3(ox+0,oy+10,oz+0))#,startPos=Point3(10,10,5))
		self.whi2=self.weaponm.hprInterval(2,Point3(oh+-45,op+-400,orr+0))#,startHpr=Point3(-90,10,2))
		self.wpi3=self.weaponm.posInterval(2,Point3(0,10,0),startPos=Point3(0,-10,0))
		self.whi3=self.weaponm.hprInterval(2,Point3(180,0,0),startHpr=Point3(0,0,0))

whi3/wpi3 aren’t done. I’ll make functions gather the start position of the weapon instead of making them constants like that, but yeah, this has worked for now. It seems there shud be a better way though.

Thanks for prodding me to the right troubleshooting method, mate.

Edit:
Eh, still have a problem tho - how do I get it to be relative? I don’t want to have to account for previous position every time I move the sword - I can write a function for this, but it seems unintuitive for a panda thing, I’d think there already is one, no?