Create / Copy Pivot with Types

Blitz3D Forums/Blitz3D Beginners Area/Create / Copy Pivot with Types

_PJ_(Posted 2004) [#1]
Is it me or does this not work???

I am trying to place a pivot at the maximum range point for my bullets.

The bullets are maintained within Types. I originally tried
NewBullet\Piv_End=CreatePivot()

but realised Blitz thinks it should just be a variable, not a handle and it's quite wasteful (considering how many bullets may be fired!) So I changed to CopyEntity (The Original Pivot_End_Template is created earlier on.

However, I keep getting an Entity Doesn't Error with the MoveEntity line regarding the pivot.

		NewBullet.Bullet = New Bullet
		
		NewBullet\Range=Gunrange
		NewBullet\Speed=GunSpeed
		NewBullet\Damage=Gundamage
		NewBullet\Anim=0
				
		NewBullet\sprite=CopyEntity (bullet_sprite)
		EntityAlpha NewBullet\Sprite,1
		
		EntityType NewBullet\Sprite,3 
		
		PositionEntity NewBullet\Sprite,EntityX#(cockpitcam,1),EntityY#(cockpitcam,1),EntityZ#(cockpitcam,1)
		RotateEntity NewBullet\Sprite,EntityPitch(ship,1),EntityYaw(ship,1),EntityRoll(ship,1)
		
		EntityRadius NewBullet\Sprite,3,3
		EntityPickMode NewBullet\Sprite,1
		
		NewBullet\Piv_End=CopyEntity(pivot_end_template)
		PositionEntity NewBullet\Piv_End,EntityX#(cockpitcam,1),EntityY#(cockpitcam,1),EntityZ#(cockpitcam,1)
		RotateEntity NewBullet\Piv_End,EntityPitch(ship,1),EntityYaw(ship,1),EntityRoll(ship,1)
		
		MoveEntity Piv_End,0,0,NewBullet\Range



GfK(Posted 2004) [#2]
I am trying to place a pivot at the maximum range point for my bullets.
Problems aside, why would you need to do that?


_PJ_(Posted 2004) [#3]
Because my game uses a variety of different weapons, I am trying to minimise the number of separate routines. I will need a pivot for LinePicks when I work on laser beams (Long stretched meshes). It's not so important for the bullets as the Range Field can be decreased each loop until 0 when I can delete the instance (checking for collisions each loop until then).

Worse come to worse, I can rethink my idea and omit the Pivot, but this is a strange one nonetheless.

Thanks for looking so quickly, GFK!


Stevie G(Posted 2004) [#4]
Should you not be using this ..

moveentity NewBullet\Piv_End,0,0,NewBullet\Range



_PJ_(Posted 2004) [#5]
HAHAHA! Oh my gosh I feel so dumb!

Thanks Stevie!