Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Fri Aug 18, 2017 9:58 pm

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Aiming with a weapon
PostPosted: Sun Nov 04, 2007 10:28 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
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?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 04, 2007 4:23 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 04, 2007 6:49 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
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...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 1:03 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Still i need help with this matter


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 11, 2007 10:31 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 11, 2007 10:43 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
i forgot the "angle motor" :P,i was trying with direct rotations of the element.
I go to make a new test :) Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 11, 2007 11:38 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
I must admit I forgot "amotors" in my first post too. It's a very easy (and physically clean) way to do such things.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 12, 2007 1:01 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
ODE is not my friend... :x
What i'm doing wrong?
http://pastebin.com/f111d0212


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 12, 2007 4:59 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
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 !


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 12, 2007 5:13 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 13, 2007 12:56 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Just i have commit the fix with a fail-safe configuration if the config file is missing.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group