Raydium 3D Game Engine
https://memak.raydium.org/

Aiming with a weapon
https://memak.raydium.org/viewtopic.php?f=8&t=709
Page 1 of 1

Author:  vicentecarro [ Sun Nov 04, 2007 10:28 am ]
Post subject:  Aiming with a weapon

I'm making a testing modification from test6.c.
In the player object i want to put a weapon that should aim to the aimin cursor.
Currently i have added the new element (called ak47) inside the object PLAYER and then i have moved and linked it to the main element of the object, called player(lowercase).
With a universal joint i can achieve the weapon be aligned in one axis(the horizontal plane) but i can not achieve the weapon aims down and up according the mouse look.
Ideas?

Author:  Xfennec [ Sun Nov 04, 2007 4:23 pm ]
Post subject: 

Parhaps can you can use another joint, like the hinge one, and rotate the weapon according to the camera.
You can do that in display(), near the call to "raydium_ode_element_player_angle_name()" using cam_angle_v (you may have a few simple maths to do, since this var is using degrees in the [1,179] range).

Just an idea.

Author:  vicentecarro [ Sun Nov 04, 2007 6:49 pm ]
Post subject: 

I'll give it a try with your idea.

Btw, i have prepared(not modeled)+textured+baked+exported an ak47 which i'm using for this test.

Here a shot:Image

And here the model:http://vicentecarro.dyndns.org/raydium/ak47.tar.bz2
The model has been downloaded from the blender model repository, so it's free, and of course my work over it is also free (say Creative commons that allows all kind of modifications, use, commerce and everything).

update:
Oh man, this is harder than i though...
It can not be so difficult to joint an element, inherit its movement and after that apply it a relative angle...

Author:  vicentecarro [ Thu Nov 08, 2007 1:03 pm ]
Post subject: 

Still i need help with this matter

Author:  Xfennec [ Sun Nov 11, 2007 10:31 pm ]
Post subject: 

What's the exact problem ? Is the hinge joint itself works in your example ? (the gun should freely rotate around the "arm" of the player). Then you can simply use an "angle motor" to rotate the gun easily around the arm.

Author:  vicentecarro [ Sun Nov 11, 2007 10:43 pm ]
Post subject: 

i forgot the "angle motor" :P,i was trying with direct rotations of the element.
I go to make a new test :) Thanks

Author:  Xfennec [ Sun Nov 11, 2007 11:38 pm ]
Post subject: 

I must admit I forgot "amotors" in my first post too. It's a very easy (and physically clean) way to do such things.

Author:  vicentecarro [ Mon Nov 12, 2007 1:01 am ]
Post subject: 

ODE is not my friend... :x
What i'm doing wrong?
http://pastebin.com/f111d0212

Author:  Xfennec [ Mon Nov 12, 2007 4:59 pm ]
Post subject: 

IMHO, you should use a hinge joint. It's more convenient and easy to create than a universal joint. Let this joint turn around the Y axis. You may have to use raydium_ode_motor_power_max_name() to adjust the engine's power, I can't remember default value. A value of 0.2 is able to move wheels of our famous Clio, so it should be ok for an AK-47 :)

Hope that helps !

Author:  ouille [ Mon Nov 12, 2007 5:13 pm ]
Post subject: 

I look at your code this afternoon.

some problems with
Quote:
raydium_init_load("exampleconfig.txt");


without the file the application fails.

Need to be corrected in the dll (creating a default configuration ?).

The gun have strange behaviour. But i don't manage to fix it.

Perhaps problem with joint parameter but i don't dig further.
Xfennec an idea ?

Have a nice day
Ouille.

Author:  vicentecarro [ Tue Nov 13, 2007 12:56 am ]
Post subject: 

Just i have commit the fix with a fail-safe configuration if the config file is missing.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/