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.

DLL Talk / EZrotate Enhanced

Author
Message
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 3rd Nov 2004 10:58
lol

I'll try to post the features tomarow.

EZrotate!
Tokamak Physics Wrapper!
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 16th Nov 2004 01:58
I've noticed a bug with RotateTo: If the object is repositioned, the object that was rotating to it flicks to point towards the new position. Source is included. Thanks for any help.

Cheese!
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 16th Nov 2004 02:57 Edited at: 16th Nov 2004 02:57
Narf,

I tried the program that you attached. It isn't a bug. You are simply "rotating to" very quickly. You are rotating at 5 degrees per call via you line:
EZro_RotateTo 2,object position x(t2),object position y(t2),object position z(t2),5
This is getting called in every loop iteration. If this runs at 100fps, that means that your ships could rotate 500 degress per second. Try reducing the angle value. For instance, to test it out, use this:
EZro_RotateTo 2,object position x(t2),object position y(t2),object position z(t2),0.05

I am pretty sure that will solve your problems.

WOLF

EZrotate!
Tokamak Physics Wrapper!
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 16th Nov 2004 03:02 Edited at: 16th Nov 2004 03:21
Huh. I'm pretty sure I checked before I posted...Anyway, for the last problem: Thanks. I guess I had a brain glitch, because I modified everything else by the FPS.

How do you use AngleBetweenPoints? It's a bit obscure. And if I am using it right, then it's not working(See source for what I'm using).

I don't think it adjusts for the objects angle.

And while I'm here and bugging you, a command to find the distance between two angles would be nice.

Cheese!
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 16th Nov 2004 03:44
This is form your code:
test1a#=object position x(t):test1b#=object position y(t):test1c#=object position z(t)
test2a#=object position x(t):test2b#=object position y(t):test2c#=object position z(t)

Note that the x, y, and z positions that are used are exactly the same for test1 and test2.
I assume that you are trying to measure the angle between the heading of one ship, to another ship. If so, the First xyz position that you want to pass is the location of the base ship. The second position that you want to pass is some point along the current z axis of the base ship. In a sense, what you are doing is defining a line that represents the Z axis (heading direction) of the ship. The third, and final xyz position should be the location of your other ship.
So, now imagine a line drawn from the first point to the second point. Now imagine another line drawn from the first point to the third point. The "find angle between points" feature will measure the angle between those to lines.


Here is some quick Psuedo code to show you how to do it correctly:



Hope that helps

EZrotate!
Tokamak Physics Wrapper!
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 16th Nov 2004 03:58 Edited at: 16th Nov 2004 03:58
That's why I'm moving it 2500 in between those two calls. Shouldn't that work?

Cheese!
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 16th Nov 2004 04:18
Doh!
I'm not sure how I missed that

Anyway, yes, that should work. I've written a little snippet to check and everything seems to work just fine. Here is the snippet:



I don't see any problems???

EZrotate!
Tokamak Physics Wrapper!
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 16th Nov 2004 04:37 Edited at: 16th Nov 2004 05:10
Try running this. The second to last value shown in the list is the angle returned.

http://www3.telus.net/funnybnz/Space Fighters.rar

You'll need to add your Fighter.x/.bmp.

Updated it with rem statements, as those are really helpfull. Oops. And I really should tell you what your looking for. Basically, sometimes it'll show a high angle, sometimes over 100, when it's pointing right at the target.

Cheese!
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 16th Nov 2004 08:13 Edited at: 16th Nov 2004 08:13
Came back home, thought of intersect object...Not as good as I want, since it doesn't return an angle, but good enough for a simple program.

Would like to get the angle function working though.

Cheese!
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 16th Nov 2004 11:06
I'll have a look tomarow.

EZrotate!
Tokamak Physics Wrapper!
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 16th Nov 2004 13:43


Cheese!
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 16th Nov 2004 22:25
Well that was a pain in the butt to find....

Here is your bug:
test3a#=object position y(t2):test3b#=object position y(t2):test3c#=object position z(t2)

The line should be:
test3a#=object position x(t2):test3b#=object position y(t2):test3c#=object position z(t2)

All is fixed

EZrotate!
Tokamak Physics Wrapper!
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 17th Nov 2004 06:54
Thanks. Now, if you'll excuse me, I need to find a wall and apply my head against it. I checked those lines 5-10 times!

Cheese!
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 17th Nov 2004 20:03
@Wolf

Please can I request some further functionality?

What I'd really like is a command that rotates one vector around another.

Cheers

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 17th Nov 2004 20:04
PS: I'd also like Christmas to be every day of the year and for every train to run on time. If you can sort those out as well, you'll be my hero.

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 17th Nov 2004 22:00
Narf,
I missed it a few times myself.

Philip,
It might be a little while before I can add that natively to EZrotate as I am currently tied up in another project. There is an easy way to do that currently from EZrotate via the Orbiting feature. Here is some psuedo code for what you need to do:



I hope this helps at least temporarily until I can work out something better internally. Remember that vector 1 should be normalized for this to work. I am sure that you know how to do that being the vector guru that you are. Vector 2 dosn't need to be normalized. EZrotate will take care of that for you.

WOLF

EZrotate!
Tokamak Physics Wrapper!
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 18th Nov 2004 21:01
Yes, thats a very sneaky workaround Mr. WOLF. I hadn't thought of that.

I was thinking more of canonical vector rotation : http://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran/3drota.htm but your workaround will certainly do the trick, and in a very comprehensible and straightforward fashion as well.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th Nov 2004 21:10
Mr.Wolf,

I'm planning on buying your delightful plugin, but I was wondering how easy it is for it to calculate euler limb angles - like the 'rotate to' feature, which I imagine is for objects. I'm using a limb on a boned mesh, like the torso on a character, and I'd love to use the 'rotate to' feature on my character so he aims at a set 3D location.

The code I came up with obviously suffers from euler hell, so is it easy to apply the rotation to limbs? (hopefully without the need to adjust my bones).


Van-B


It's c**p being the only coder in the village.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Nov 2004 22:12
Quote: "I'd also like Christmas to be every day of the year and for every train to run on time"


Trains don't run on bank holidays, cancelled for essential maintenance - just when people need them. So technically, if Christmas is every day, there are no trains and thus no delays.

BatVink
http://biglaugh.co.uk/catalog AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 18th Nov 2004 22:28 Edited at: 18th Nov 2004 22:29
Working with limbs is a tricky matter. My plugin will definately help, but it still won't be a simple task.

The trick is that limb angles are stored relevant to their parent. To get the actual angle of a limb, you have to work through all of the parents.

Lets say you want to use the "rotate to" function on the right arm of a model. If your model had a hierarchy of:
-Pelvis
--Body_Low
---Body_Up
----Shoulder_Right
-----Arm_Right
You have to work progrssively through XYZ rotations on each limb to finally find where the final position is. Furthermore, it isn't as easy as simple local or global rotations. For instance, once you rotate gloably for the pelvis (first in hierarchy) on the X then Y then Z axis, that new orientation is considered the world axis for the next limb in the heirarchy. So, to rotate for the Body_Low limb, you would have to rotate "globaly" relative to the Pelvis limb orientation. This can't simply be done with the local or global rotation commands. Luckily, it can be done somewhat easily with EZrotate's vector rotation feature. The vector would be based on the matrix info for the current orientation.
You then just follow the process all the way up through the hierarchy until a final rotation is setup is complete for the arm. Now, use the "rotate to" feature on the arm limb.
What you have now is the limb rotated correctly relative to the true global axis. You now have to work back to find out what that rotation would be relative to the shoulder limb's orientation.

Complicated? Yes. It is possible though. If you decide that this is something that you want to persue, then I'll be glad to help you if/when you get stuck.

WOLF

EZrotate!
Tokamak Physics Wrapper!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th Nov 2004 22:56
Sounds very complicated . You know I suck at math right?.

I have them aiming almost perfectly, that's the annoying thing, they aim just how I want them, it's just the daft things they do to get there that's the problem.

I think I'll experiment for a bit once I get the plugin - if I get stuck, hopefully you'll help me out (I reckon this problem might crop up a lot).

The only sidestep I can think of is to break the enemy mesh in half so I can adjust the torso seperately. That really screws things for animating though, death animations in particular.

Cheers,

Van-B


It's c**p being the only coder in the village.
Ron Erickson
Moderator
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: Pittsburgh, PA, USA
Posted: 18th Nov 2004 23:42 Edited at: 18th Nov 2004 23:43
Van,
I'll be glad to help you out with it. It really isn't THAT complicated, it just sounds worse than it is. Once it is worked out, then it is done forever.

I *was* going to add something internally to EZrotate for working with limbs. I asked Mike to add a GET PARENT command that would return the parent of a limb, but, well... I doubt we'll be seeing that any time soon. Without being able to know limb parents, it is impossible for me to really add anything directly to the plugin.

Still, all the tools exist in EZrotate to do what you are after.

EZrotate!
Tokamak Physics Wrapper!

Login to post a reply

Server time is: 2024-11-21 14:02:52
Your offset time is: 2024-11-21 14:02:52