Hey
Did anyone get any player to shoot a bullet or object? I’m looking over the Ninja code for a example but the obvious answer I’m not seeing.
This is the code I’m tryiing. No matter what direction or rotation. It seems not to set and shoots in he same direction even if the character is turned around.
I would like some flying mushrooms. Kidding.
Vivienne
[code] /// Create Node
Node * mushroomNode = scene_ -> CreateChild(“MushroomNode”);
Node * characterNode = scene_ -> GetChild(“Character”);
Vector3 characterPosition = characterNode -> GetPosition();
Quaternion characterRotation = characterNode-> GetRotation();
/// Get Node position
mushroomNode->SetPosition(characterPosition+Vector3(0.0f,1.0f,3.0f));
/// Load mushroom
StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
/// Create physics
CollisionShape* mushroomShape = mushroomNode->CreateComponent<CollisionShape>();
mushroomShape->SetBox(Vector3::ONE);
mushroomShape ->SetLodLevel(1);
RigidBody* mushroomBody= mushroomNode ->CreateComponent<RigidBody>();
mushroomBody->SetCollisionLayer(1);
mushroomBody->SetCollisionEventMode(COLLISION_ALWAYS);
/// Set Lifetime
GameObject * Lifetime = mushroomNode->CreateComponent<GameObject>();
Lifetime->SetLifetime(20);
mushroomBody-> SetMass (.5);
mushroomNode-> SetRotation(characterRotation);
mushroomNode-> Translate(Vector3::FORWARD*2.0f);[/code]