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:
This only seems to do this with LoadAnimB3D, if I change it to CreateCube() it seems to work okay. Thanks.
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.