Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Need help with simple time conundrum?

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
cbx Posted - Mar 17 2004 : 1:54:51 PM
OK This is really strange....
I am creating some Animation/Track classes for storing key framed animation.
But it only seems to work one way but not the other. I have attached the vb.net code as well as the exe and required dlls. NOTE: That the exe is compiled for the .NET Framework and you will need the framework installed in order for it to run. You will also need DirectX9 installed as well.

First run the "Animation Rotation.exe". You should see a box being rotated. That one works just fine.

Here comes the strange part. Next run the "Animation Scaling.exe". You should see the same box but it will be scaled instead of rotated. Just let the app run and you will start to see the animation slow down! What the heck is up with that?

If you unzip the source code you will see a Animation.vb file. In that file you will see a Animation module with one method called Update. That is where I blend between keys using the Vector3.Lerp function.

What is strange is that the roation and scaling BOTH use a vector3 structure to store there roation and scaling. And yet the rotation animation works but not the scale animation.

To toggle between scaling animation and rotation animation just go into the Form1.vb file and look for the SetupAnimations method near the bottom of the file. In that method you will see a varible decloration "Dim Onlyscaling As Boolean = True" simply change it to "Dim Onlyscaling As Boolean = False" in order to view the Rotation animation.

I believe my problem lies with the Update method in the Animation.vb file. But I can't seem to figure out why.

Anybody have any idea as to why this is that case and why the animation slows down only during scaling but not when rotation?


Download Attachment: Ani.zip
68.23 KB
8   L A T E S T    R E P L I E S    (Newest First)
VBBR Posted - Mar 18 2004 : 3:13:30 PM
Just reinstalled DX and it is working now, probably wouldn't have found the problem if I couldn't run the program. But thanks anyway.
cbx Posted - Mar 18 2004 : 2:45:26 PM
OMFG! Dude, seriously, i have to be loosing my mind not to see that! lol

Not catching that simple mistake is definatly a new low for me. geeze. After having a good long laugh at my self I still just can't believe I did not see that.

Well at least I can continue working on a graphics demo.

VBBR if your DX references are not showing up under add references you can copy the dx files ...

Microsoft.DirectX.AudioVideoPlayback.dll
Microsoft.DirectX.Diagnostics.dll
Microsoft.DirectX.Direct3D.dll
Microsoft.DirectX.Direct3DX.dll
Microsoft.DirectX.DirectDraw.dll
Microsoft.DirectX.DirectInput.dll
Microsoft.DirectX.DirectPlay.dll
Microsoft.DirectX.DirectSound.dll
Microsoft.DirectX.dll

... from your c:\windows\assembly\ folder to something like c:\dx9\ That's what I did when I could not get the dx files to show up in the add references dialog. THen you can just reference the libraries from there. Although I'm sure you would prefer to just make a reference from the add references dialog...
VBBR Posted - Mar 18 2004 : 12:15:22 PM
GOT IT !!! The problem is in the SetupAnimations Sub. It's actually very simple.
In the rotation part of the sub, you put something like that:

V.X = DegreeToRadian(45)
'V.Y = V.X
'V.Z = V.X
lngValue = mobjTimer.MilliToTicks(100)
RT.Add(New DX9Tools.Animation.KeyVector3(lngValue, V))

NOTE the signal after lngValue is "=".
Now look at how you defined the keys in the scaling part:

lngValue += mobjTimer.MilliToTicks(210)
ST.Add(New DX9Tools.Animation.KeyVector3(lngValue, New Vector3(2, 1, 1)))

Now, NOTE the signal after lngValue is actually "+=".
Then look at the Update sub:

If lngCurrentTime - T.BaseTime > T.Item(T.CurrentKeyIndex).Time Then
T.BaseTime += T.Item(T.CurrentKeyIndex).Time '- T.BaseTime
T.CurrentKeyIndex += 1
End If

NOTE the "+=" signal there.

That means, there's a "+=" in the SetupAnimations sub AND in the Update sub.
Then, all you have to do is replace the "+=" in the scaling part of SetupAnimations with "=".

Whew! Hope that will help a little!
VBBR Posted - Mar 18 2004 : 12:01:09 PM
I believe the problem is with the ST V3Track... Because I made the rotation routine use the ST and rotation also was becoming slow... Like that: (with "Dim Onlyscaling As Boolean = True")

Dim MX As Matrix = Matrix.Identity

'MX.Multiply(Matrix.Scaling(Animation.Update(ST, mobjTimer.LastCapturedTime)))
With Animation.Update(ST, mobjTimer.LastCapturedTime)
MX.Multiply(Matrix.RotationYawPitchRoll(.X, .Y, .Z))
End With

G.Device.SetTransform(Direct3D.TransformType.World, MX)

The result is the box rotates in the Y axis slower and slower. Try to take a look at the ST thing.
VBBR Posted - Mar 18 2004 : 10:52:48 AM
I will take a closer look at the code as soon as I have my DX9 working with VS 2003... DirectX simply doesn't appear at the References dialog list... I will try reinstalling the SDK.
cbx Posted - Mar 17 2004 : 9:06:57 PM
I just did another test to see if maybe it was because there were alot of keys in the scaling animation but not the rotation animation so I added a bunch more keys to the rotation track and rotation still worked fine. So the number of keys in a track is not the problem, and I'm still stumped...
cbx Posted - Mar 17 2004 : 9:01:42 PM
quote:
Originally posted by VBBR

Hum... have you tried translation as well?



Just tried translation an it did the same thing as scaling, IE: the animation slows down as time progresses. Seems only the rotation works properly. Strange, very strange?
VBBR Posted - Mar 17 2004 : 3:28:38 PM
Hum... have you tried translation as well?

VBGamer © Go To Top Of Page
This page was generated in 0.09 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.