Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: GetRotation increases speed on path.  (Read 1135 times)
EvilYogurt
Community Member
*
Posts: 6


« on: August 03, 2010, 03:21:16 AM »

Using GetRotation function on a mesh which is moving along a path, causes incease of speed about two times. The same happens when i try to attach some mesh to a mesh that is moving along path. Everytime I try to attach any mesh, the parent mesh is moving faster. Sample code:

Code:
CTVMesh* parent;
CTVMesh* child;
CTVPath* path;

...

path->AddPathNode (...);

...

parent->SetPath (path, true);
parent->SetPathSpeed (10.f, true);

// This call causes increase mesh speed during movement along path.
child->AttachTo (cTV_NODETYPE_MESH, parent->GetIndex(), -1);

Anyone had the same issue? Is there any work-around to this problem?
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4946


WWW
« Reply #1 on: August 04, 2010, 10:16:58 AM »

Oops I think i know the problem.
UpdateEntity is called twice (the children must get the worldmatrix from the parent)

Unfortunately no workaround that I can see for now... Just divide the speed by 2 when you know it happens...

I will try to fix this for the next version

Thanks for the bug report.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #2 on: August 04, 2010, 03:48:21 PM »

Wow. I didn't know TVMesh.Update causes the path speed to speed up. That means you can't even use TVMesh.SetMatrix to correct the mesh to where it's supposed to be. Also if you modify the mesh's position/orientation/scale in any way multiple times, that kinda makes tvpath unusable.

I have found a half-baked work-around. Any time you are planning on doing anything with the mesh, set the path to null first. Then when your done, reset the path. It's not a general solution you have to know what TVPath object to set to that TVMesh, and it's properties ahead of time. There is no TVMesh.GetPath or TVMesh.GetPathProperties so the work-around breaks OOP rules.
Logged

JAbstract.....Don't just imagine, make it happen!
TecnoBacon
Customers
Community Member
*****
Posts: 305


WWW
« Reply #3 on: August 05, 2010, 09:39:06 AM »

Personnaly I just keep movement in register arrays and set the mesh from that so I never saw this problem, good catch.
EB
Logged

www.TecnoBacon.com - the other side of the Bacon family! 3D Development, Music and more.
EvilYogurt
Community Member
*
Posts: 6


« Reply #4 on: August 06, 2010, 01:10:34 AM »

Yes, I figured it out, that every additional call of Update() function, causes that mesh is moving faster along the path.

Quote
Wow. I didn't know TVMesh.Update causes the path speed to speed up. That means you can't even use TVMesh.SetMatrix to correct the mesh to where it's supposed to be. Also if you modify the mesh's position/orientation/scale in any way multiple times, that kinda makes tvpath unusable.

With position the problem doesn't occur. Only with rotation. You can Get/Set a position and the mesh is moving normally. But when you want to do something with rotation it is speeding up.

Quote
I have found a half-baked work-around. Any time you are planning on doing anything with the mesh, set the path to null first. Then when your done, reset the path. It's not a general solution you have to know what TVPath object to set to that TVMesh, and it's properties ahead of time. There is no TVMesh.GetPath or TVMesh.GetPathProperties so the work-around breaks OOP rules.

I'll try that. Thanks.

Not everyone is strictly following OOP rules Wink There are often situations where you can break them down, because it'll speed up coding or will just simplify certain things. Nothing wrong with that.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks