Bezier Path Conundrums
by Laban · in Torque Game Builder · 02/04/2007 (3:24 am) · 3 replies
Hello,
I'm trying to use the pathing system and keep running in to a few annoying hurdles. I'm new to Torque - and the scripting way of thinking - so I'm hoping that I'm missing something obvious.
What I have so far is a bezier path that leads objects (balls) on a path. Here are my issues, grateful for suggestions on how to resolve any one of them:
1) The objects on the path slow down significantly before curves. This is the default behaviour it seems, I just run my balls with the same speed. Is there some way to make them go smoothly at the same speed for the entire path?
2) Someone else asked how to push objects along a path, but didn't get a clear answer. I have the exact same thing with one ball just pushing through (with some flickering) another instead of moving it. Grateful for hints on how to accomplish this.
3) When creating balls (t2dStaticSprite) from script and mounting them to the path I get the weirdest bug. The first time no ball appears, the second time it works as expected and the third time other unrelated objects get attached to the path or TGB just crashes.
The code:
%myBall = new t2dStaticSprite()
{
scenegraph = %this.scenegraph;
class = Ball;
imageMap = redballimagemap;
layer = 18;
size = "4.0 4.0";
CollisionActiveSend = "1";
CollisionActiveReceive = "1";
};
thePath.attachObject(%myBall, 15, 1, 3, 6, "WRAP", 1, false);
I'm trying to use the pathing system and keep running in to a few annoying hurdles. I'm new to Torque - and the scripting way of thinking - so I'm hoping that I'm missing something obvious.
What I have so far is a bezier path that leads objects (balls) on a path. Here are my issues, grateful for suggestions on how to resolve any one of them:
1) The objects on the path slow down significantly before curves. This is the default behaviour it seems, I just run my balls with the same speed. Is there some way to make them go smoothly at the same speed for the entire path?
2) Someone else asked how to push objects along a path, but didn't get a clear answer. I have the exact same thing with one ball just pushing through (with some flickering) another instead of moving it. Grateful for hints on how to accomplish this.
3) When creating balls (t2dStaticSprite) from script and mounting them to the path I get the weirdest bug. The first time no ball appears, the second time it works as expected and the third time other unrelated objects get attached to the path or TGB just crashes.
The code:
%myBall = new t2dStaticSprite()
{
scenegraph = %this.scenegraph;
class = Ball;
imageMap = redballimagemap;
layer = 18;
size = "4.0 4.0";
CollisionActiveSend = "1";
CollisionActiveReceive = "1";
};
thePath.attachObject(%myBall, 15, 1, 3, 6, "WRAP", 1, false);
#2
Hopefully they have made some changes in the upcoming release that is now in closed beta.
You cannot change speed or direction of an object mounted on a path without causing the object to reset to start of path... That's what I ran into anyway.
I had a better response but accidentally deleted it somehow..To late to rewrite, going to bed ZZZ....
02/04/2007 (8:11 pm)
Paths have serious problems as of 1.1.3.Hopefully they have made some changes in the upcoming release that is now in closed beta.
You cannot change speed or direction of an object mounted on a path without causing the object to reset to start of path... That's what I ran into anyway.
I had a better response but accidentally deleted it somehow..To late to rewrite, going to bed ZZZ....
#3
More info or ideas are appreciated.
02/05/2007 (2:30 am)
Thanks for your answers. If what Dustin says is indeed so I can't use paths the way I intended it seems, since I would want objects to both change direction and speed without being reset.More info or ideas are appreciated.
Associate David Higgins
DPHCoders.com
Basically, if the object is moving at a speed of 100 -- and it hits a curve, that curve would visually make the ball appear to be in the same spot for a short period of time (or long, depending on the actual speed of the object)
This can be remedied by making the path curves less dramatic, or by increasing the ball speed to compensate for the illusion effect
As for pushing objects along the path, you would have to implement physics and collision responses and have all the objects being affected react properly to the 'push'.
As for the scene object issue, I'm affraid the code you provided seems 'ok' and your issue is most likely elsewhere in the code.