Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Anyone want to look at some limbs and angles?

Author
Message
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 23rd Mar 2011 20:33 Edited at: 23rd Mar 2011 20:34
I'm trying to apply different animations to the same object (for example, have the upper body point a gun while the lower body walks) by playing the two animations on different hidden objects, then getting the angles from the limbs of each object as appropriate and using them to pose the visible model. The main problem I'm having is that the limb angle x/y/z commands don't actually reflect changes from animation, so I can't just rotate each limb with the angles from its counterpart. The limb direction x/y/z commands do reflect this, but these are global angles. I thought simply subtracting the limb direction of the parent would be sufficient to get me the local angle, but this isn't working.

Anyone have any ideas? I've attached a project you can use to play around with things (uses the Matrix1 dlls).

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 24th Mar 2011 10:29 Edited at: 24th Mar 2011 11:05
[edit]
Meh, I tried something and it failed. i did, however, find out that... I think you should be using "get limb sibling", as get limb parent always returns -1 in your demo.

BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 24th Mar 2011 16:40
Aha, well it doesn't always return -1, but it does return -1 for some limbs that do actually have parents. Seems like any limb that shares its parent with another limb gets a -1.

I've written my own getLimbParent function to correct that. Your code did give me a few ideas I need to play with.



BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 24th Mar 2011 18:27
Okay, I'm getting really close with the original angle subtraction idea. The animation is almost identical, but there are still a few kinks.



Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 24th Mar 2011 18:46
I would have 2 'dummy' limbs, one on each end of the barrel. Then you have an exact position of each end of the barrel, and can work out the aiming angles and vector. Maybe then compare this with the player position, and adjust the torso bone angles to suit. Maybe even adjust 2 bones on the spine, one for X rotation and the other for Y. It might be possible to keep it smooth with some clever vertex strength assignment.

Having those 2 dummy limbs for the barrel is vital I think - you can position gun flares, work out bullet trajectories, as well as knowing where the gun is aiming. When an enemy is moving they automatically have to adjust their aim more, when they are still they should be able to get a perfect aim quite quickly. I would work out the difference in angles between the enemy and player and enemies barrel, then have them turn and aim up, but with a limited speed. It won't be exact, but it should be possible to make some challenging AI that way.

Health, Ammo, and bacon and eggs!
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 24th Mar 2011 19:37
Well, for the actual project I'm working on (a third-person shooter), this is for visual purposes only. The actual bullet trajectory is based entirely on the player's position and the position of the crosshairs. The visual gun will be just for looks. So the main thing I need is to be able to play a number of different animations on the upper body based on what weapon the player is holding (rifle, pistol, grenade, etc) while the lower body does walking, crouching, etc animations.

I probably will need to do something like you described for the player to actually look where the crosshairs are. Some good ideas there for AIs, too. That's the next thing I have to get to when I work this out .

Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 25th Mar 2011 23:22 Edited at: 10th Sep 2011 00:37
The "Get Limb Parent" Matrix1 command works correctly.
We discovered that the "Load Object" command does not import the Limb Parent relationships correctly. This was a confirmed bug with the "Load Object" command.

http://forum.thegamecreators.com/?m=forum_view&t=163815&b=15

We wrote a DBPro plugin which repairs the objects hierarchy after it is loaded. The DBPro plugin and .ini file are attached.

We updated your code to use the command from our DBPro plugin.
This eliminates the need for you to hard code your objects hierarchy.Hope this helps your projects.



[img][/img]


WindowsXP SP1,Vista,Windows 7 DBpro v7.61
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
miso
16
Years of Service
User Offline
Joined: 16th Jun 2010
Location: Budapest, Hungary, 127.0.0.1
Posted: 26th Mar 2011 09:24
Grat, that's very nice, thank you. Need to add offset commands and it will fit perfectly for any purpose.

No place like 127.0.0.1 .
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 28th Mar 2011 04:46
Well, it doesn't quite work yet. You can still see some funniness, especially in his hands, the offsetting limbs is giving me even more trouble.

For now, I'm resorting to having two seperate objects with different halves of each object hidden. It seems to be working out better than I had hoped, and I'm fine with it. If anyone has a breakthrough, though, this method would be much cleaner and probably superior.

Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 28th Mar 2011 16:52
BMacZero
Did you try the Dll and code I posted in the above post?


[img][/img]


Custom,intel 3.0GHz Hyper Threaded,4GB RAM,ATI X1500 256mb,
WindowsXP DBpro v7.5 Synergy
The coffee is lovely dark and deep,and I have code to write before I sleep.
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 28th Mar 2011 17:59
Yes, I did, thanks . That's very good to know about. However, it doesn't really change the operation of the code, since for this particular model it returns exactly the same thing as the function I wrote, so it didn't solve the problem.

Login to post a reply

Server time is: 2026-07-16 23:18:56
Your offset time is: 2026-07-16 23:18:56