This project is read-only.

scene.Remove() not working?

Jan 17, 2013 at 7:59 PM
Edited Jan 21, 2013 at 2:32 PM

EDIT:

Fixed: checking a group fixed the problem.



Hello,

I'm trying to get rid of my 'zombie' when hitting it with a bullet, however the scene.Remove doesn't seem to do it's work properly, or I'm doing something wrong.

This is how I find my 'zombie' in the scene:

var Zombie = scene.FindName<Nine.Graphics.Model>("Zombie");



This is how I check the distance between the bullet and the zombie:

distZombie = Vector3.Distance(Zombie.AbsoluteTransform.Translation, Player.AbsoluteTransform.Translation);

 

And last but not least, the removal procedure:

if (Bullet != null)
            {
                distBullet = Vector3.Distance(Zombie.AbsoluteTransform.Translation, Bullet.AbsoluteTransform.Translation);

                if (distBullet <= 20)
                {
                    scene.Remove(Zombie);
                }
            }

 

I know the 'if statement' works, because I tried to decrease my health when the distBullet returned true, that worked.


Why won't the scene.Remove() work?

Thanks.