Hidden Entity showing after being created?

BlitzMax Forums/MiniB3D Module/Hidden Entity showing after being created?

verfum(Posted 2007) [#1]
Hiya, my code is creating a TWeapon which holds info like the projectile's file$ and velocity etc. in here I Hide the ent.model, then when you press fire it creates a TBullet, the TWeapon info is passed to the TBullet including the model's file$. Now what happens is the model is hidden until the fire button is pressed, a bullet is created moving away from the player as normal but a second one is created smack bang in the middle of the camera?! Almost as if the HideEntity function has been turned off, and another one is created ever fire press.

Here are the two functions for creating the Weapon and then the Bullet:
Type TWeapon
	Field model:TEntity
	Field name$
	Field thrust#
	Field carriedBy:TPlayer
		
	Method fire(p:TPlayer)		
			Local Shot:TBullet = TBullet.Create(p)
	End Method

	Function Create:TWeapon(name$,file$,thrust,carriedBy:TPlayer)
	Local ent:TWeapon = New TWeapon
	ent.name$ = name$
	ent.thrust = thrust
	ent.model = LoadAnimB3D(file$)
	ent.carriedBy:TPlayer = carriedBy:TPlayer
	HideEntity ent.model
	ListAddLast(entity_list,ent)
	Return ent
	End Function
	
	Method Update()

	End Method
	
End Type

Type TBullet
	Field yaw#,thrust#
	Field model:TEntity
		
	Function Create:TBullet(p:TPlayer)
	Local ent:TBullet = New TBullet
	ent.yaw = p.yaw
	ent.thrust = p.thrust + p.currentWeapon.thrust
	ent.model = CopyEntity(p.currentWeapon.model)
	RotateEntity ent.model,0,ent.yaw,0
	PositionEntity ent.model,EntityX(p.model),EntityY(p.model),EntityZ(p.model)
	ListAddLast(entity_list,ent)
	Return ent
	End Function
	
	Method Update()
		MoveEntity model,0,0,thrust
	End Method
End Type

This only seems to do this with LoadAnimB3D, if I change it to CreateCube() it seems to work okay. Thanks.


verfum(Posted 2007) [#2]
I think it has something to do with the Blitz3D Pipeline exporter for 3dsmax. I've managed to turn XRef off on exporting and it seems to be okay now.

Can anyone answer this, I believe it maybe my exporter, whenever I make keyframes in 3dsmax and export I get this error:
Unhandled Exception:Attempt to access field opr method of Null object

And it points to the above code at LoadAnimB3D, this only happens if I export with keyframes.