Let's say I have a character, and I equip an item onto him. I need the item to have it's own ODE body and geom, because collisions with other characters of the item is a must-have (say it's a sword).
How do you "glue" the sword into the wielder's hand? Make a joint or update the position of the sword's SceneNode frame by frame so it keeps nicely to the hand of the character that holds it? (The 2nd one sounds as a light hack to me, but in larger scale it shouldn't be as expensive to ODE as many joints no?)
Characters, items and alike + ODE
-
- Greenskin
- Posts: 145
- Joined: Wed Apr 28, 2004 12:10 pm
- Location: Hungary
Characters, items and alike + ODE
Hope is the first step on the road to disappointment.
-
- Google Summer of Code Student
- Posts: 228
- Joined: Mon Mar 17, 2003 12:02 am
- Location: San Jose, CA, USA
http://www.ogre3d.org/docs/api/html/cla ... 1Entitya20
There are also a few threads about it, but it's pretty self explanatory.
There are also a few threads about it, but it's pretty self explanatory.
-
- Gnome
- Posts: 335
- Joined: Sat Mar 01, 2003 11:21 pm
- Location: Idaho, USA
How about attaching the sword entity to the wrist bone in the skeleton of the character model?
Check out Ogre::Entity::attachObjectToBone()
Not sure what that would do physics wise, I assume you can disable collision between character<->sword so they wouldnt be fighting.
Havent used it, but might work nicely.
Edit: bah, beaten by Lodes
Check out Ogre::Entity::attachObjectToBone()
Not sure what that would do physics wise, I assume you can disable collision between character<->sword so they wouldnt be fighting.
Havent used it, but might work nicely.
Edit: bah, beaten by Lodes
-
- Gnoblar
- Posts: 17
- Joined: Wed Jul 14, 2004 4:26 pm
Re: Characters, items and alike + ODE
The easiest way is to attach the sword geom to the hand's body.AssiDragon wrote:Let's say I have a character, and I equip an item onto him. I need the item to have it's own ODE body and geom, because collisions with other characters of the item is a must-have (say it's a sword).
You will first need to detach it from the sword body though, and delete the sword body afterwards.
The architecture I am working on will try to hide details such as these.
Hope this helps!
-
- Greenskin
- Posts: 145
- Joined: Wed Apr 28, 2004 12:10 pm
- Location: Hungary
....I know about OGRE attaching and detaching, thanks - but so far noone brought me a bit closer...
The problem is attached objects via ODE in OgreODE don't act attached. I mean, even if you have SceneNode* B attached to SceneNode* A, B won't keep to A's position, but will move on it's own as two totally seperate bodies. I understand that ODE supports no such "attaching", as in physical simulation needs joints or some other method I don't know of. The question was aimed at "how to make this work with ODE too". Thanks
The problem is attached objects via ODE in OgreODE don't act attached. I mean, even if you have SceneNode* B attached to SceneNode* A, B won't keep to A's position, but will move on it's own as two totally seperate bodies. I understand that ODE supports no such "attaching", as in physical simulation needs joints or some other method I don't know of. The question was aimed at "how to make this work with ODE too". Thanks

Hope is the first step on the road to disappointment.
-
- Kobold
- Posts: 37
- Joined: Sun Jan 26, 2003 1:17 am
- Location: France (Paris)
-
- Greenskin
- Posts: 145
- Joined: Wed Apr 28, 2004 12:10 pm
- Location: Hungary
But then how do you know if the sword hit the target (health damage has to be done) or if the player body touched it (no damage)? Things might even get complicated if you introduce shields.
Might be lame but only this example popped into my mind...
Might be lame but only this example popped into my mind...
Hope is the first step on the road to disappointment.
-
- OGRE Retired Moderator
- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 7
You probably want to use a ball joint between the player's hand and the weapon. Through the force these two add to each other you can set the stiffness of this setup and you are able to see what other bodies/geoms the sword hits. I never used it this way and I'm sure it needs much polishing to work as expected, but it will work eventually.
-
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
indeed... would probably be really difficult. even if you get the bodies attached, you then have to try and "animate" the bodies through forces, to mimick your object's animation.
I don't think any action games (expecially 3rd person) actually check if the sword has hit the enemy on a micro-level. I think they just check the frame of current animation, and from that know a "hot zone" which is where the sword is in that frame. if an enemy is within that zone, it gets hit.
personally I think trying to let the physics do something on this level is a bit over-kill.
however I don't know what kind of game your making... a 1-on-1 sword fighting game might be really cool with truly acurate physics like you describe...
I don't think any action games (expecially 3rd person) actually check if the sword has hit the enemy on a micro-level. I think they just check the frame of current animation, and from that know a "hot zone" which is where the sword is in that frame. if an enemy is within that zone, it gets hit.
personally I think trying to let the physics do something on this level is a bit over-kill.
however I don't know what kind of game your making... a 1-on-1 sword fighting game might be really cool with truly acurate physics like you describe...

-
- Greenskin
- Posts: 145
- Joined: Wed Apr 28, 2004 12:10 pm
- Location: Hungary
Yay thanks! Will try it =)tanis wrote:You probably want to use a ball joint between the player's hand and the weapon. Through the force these two add to each other you can set the stiffness of this setup and you are able to see what other bodies/geoms the sword hits. I never used it this way and I'm sure it needs much polishing to work as expected, but it will work eventually.
Hmm... when the bone changes position using the skeletal system, the joint body in the physic engine also has to follow it... well, I'd think it should. Need to check it lol.walaber wrote:indeed... would probably be really difficult. even if you get the bodies attached, you then have to try and "animate" the bodies through forces, to mimick your object's animation.
If everything else failsI can just manually update the position and rotation of the weapon anyway.

Hmm.walaber wrote:I don't think any action games (expecially 3rd person) actually check if the sword has hit the enemy on a micro-level. I think they just check the frame of current animation, and from that know a "hot zone" which is where the sword is in that frame. if an enemy is within that zone, it gets hit.
That would need either setting a hotzone to every attack animations' every frame, or constant raycasting from the possible hit zones Either way, it has to be done taking account the used weapons' lenght, and you would still have to check not only "if the enemy is within the zone" though, as you still want to know if a shield, a sword in defensive position or other object-for-the-purpose defended the attacked entity...
Um why? This adds 1 or 2 objects per character maximum, and the same number of joints. And I already have to use physics for weapons - ranged ones to be more precise - so I dont think making this approach would put much extra pressure onto ODE. I could wrong though.walaber wrote:personally I think trying to let the physics do something on this level is a bit over-kill.

Hope is the first step on the road to disappointment.
-
- Halfling
- Posts: 62
- Joined: Mon Feb 07, 2005 9:47 pm
I think ODE might be overklil for this because you don't really care about the linear/angular velocities. Basically, you can just check if the bounding rectangle of the weapon intersects with the player, and if it does, calculate a hit.
The problem with using ODE is that now you have to keep tweaking your animation so thtat the character swings his arm fast enough to knock the other player down, and stuff like that. It can get really ugly.
However, if you are willing to put the effort into it, it could turn out really cool.
I'm also working on a fighting game and I plan on using Ogre with ODE and stuff like that. If you want to work together, lemme know. I want to make an engine similar to soul calibar, where you always face the enemy and can circle strafe and stuff like that.
The problem with using ODE is that now you have to keep tweaking your animation so thtat the character swings his arm fast enough to knock the other player down, and stuff like that. It can get really ugly.
However, if you are willing to put the effort into it, it could turn out really cool.
I'm also working on a fighting game and I plan on using Ogre with ODE and stuff like that. If you want to work together, lemme know. I want to make an engine similar to soul calibar, where you always face the enemy and can circle strafe and stuff like that.
-
- Greenskin
- Posts: 145
- Joined: Wed Apr 28, 2004 12:10 pm
- Location: Hungary
Actually, I don't want to care about velocities.DigitalGhost wrote:I think ODE might be overklil for this because you don't really care about the linear/angular velocities. Basically, you can just check if the bounding rectangle of the weapon intersects with the player, and if it does, calculate a hit.

Thanks! Hope you'll be right. Same to you.DigitalGhost wrote:However, if you are willing to put the effort into it, it could turn out really cool.

Well, thanks, but I have to decline this offer. I'm working on my game for quite a while now, and have a working game engine - well, more or less working, alright.DigitalGhost wrote:I'm also working on a fighting game and I plan on using Ogre with ODE and stuff like that. If you want to work together, lemme know. I want to make an engine similar to soul calibar, where you always face the enemy and can circle strafe and stuff like that.

Hope is the first step on the road to disappointment.