How to attach a waepon.
-
- Posts: 52
- Joined: Wed Dec 06, 2006 5:18 pm
How to attach a waepon.
With function of irrlicht engine attach a object(model) into camera(fps). I want to attach a waepon to camera likes most fps.
Last edited by alfabeta90 on Sat Mar 24, 2007 4:49 pm, edited 1 time in total.
-
- Posts: 52
- Joined: Wed Dec 06, 2006 5:18 pm
maybe because it's spelled weapon ???
try: weapon AND attach
try: weapon AND attach
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
its not that people are strict about spelling its just that the search engine wont work w/ weapon misspeled
http://irrlicht.sourceforge.net/phpBB2/ ... ght=weapon
if you cant find it
http://irrlicht.sourceforge.net/phpBB2/ ... ght=weapon
if you cant find it
right, I don't care about right spelling, but the search function does
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Posts: 52
- Joined: Wed Dec 06, 2006 5:18 pm
One more question:
Why doesn't this code work propably? It's start's a sound when key W is pressed. PS. Do u know a cool footsteps sound?
Why doesn't this code work propably? It's start's a sound when key W is pressed. PS. Do u know a cool footsteps sound?
Code: Select all
SKeyMap keyMap[4];
if(keyMap[0].KeyCode = KEY_KEY_W)
{
keyMap[0].Action = EKA_MOVE_FORWARD;
sound->play2D("pl_step4.wav");
}
keyMap[1].Action = EKA_MOVE_BACKWARD;
keyMap[1].KeyCode = KEY_KEY_S;
keyMap[2].Action = EKA_STRAFE_LEFT;
keyMap[2].KeyCode = KEY_KEY_A;
keyMap[3].Action = EKA_STRAFE_RIGHT;
keyMap[3].KeyCode = KEY_KEY_D;
Because you haven't gone through the tutorials!!
Scrap that if statement, and go and look in the tutorials for how to create an event receiver.
Then on the input event you will play the sound.
EDIT: something like
but for a proper footstep sound you should play it looped, starting on a move event and stopping when they are stationary.
Actually you don't even need an event receiver, you could just in your main loop, store the last position, and then if the current position is different, you are moving and may start the sound (if it's not already playing), otherwise stop the sound...
Code: Select all
if(keyMap[0].KeyCode = KEY_KEY_W)
{
keyMap[0].Action = EKA_MOVE_FORWARD;
sound->play2D("pl_step4.wav");
}
Then on the input event you will play the sound.
EDIT: something like
Code: Select all
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == irr::EET_KEY_INPUT_EVENT &&
event.KeyInput.PressedDown)
{
switch(event.KeyInput.Key)
{
case KEY_KEY_W:
sound->play2D("pl_step4.wav");
return true;
}
}
return false;
}
};
Actually you don't even need an event receiver, you could just in your main loop, store the last position, and then if the current position is different, you are moving and may start the sound (if it's not already playing), otherwise stop the sound...
-
- Posts: 52
- Joined: Wed Dec 06, 2006 5:18 pm
Can you check of this code is good?
Code: Select all
ICameraSceneNode wezelKamery = oknoGry.SceneManager.AddCameraSceneNodeFPS(null, 100, 300, 0);
wezelKamery.Position = new Vector3D(1000, 1000, 500);
wezelKamery.Rotation = new Vector3D(0, 180, 0);
ICameraSceneNode weapon = oknoGry.SceneManager.AddMeshSceneNode("weapon.x", wezelKamery, 1);
wezelKamery.AddChild(weapon);
oknoGry.CursorControl.Visible = false;