AddLinkPoint() bug
by Tim Doty · in Torque Game Builder · 04/12/2005 (9:56 pm) · 5 replies
I noticed that a missile was being spawned from the wrong location and have been going nuts trying to find the cause and I think I finally have: T2D.
I apologize for not having a minimal code to reproduce this, but I'll get that together when I can (its rather late right now).
What seems to be happening is the addLinkPoint("x y"); called the first time gets mangled when translating the coordinates. If called again with the exact same coords it is fine. Likewise, having an object mounted to the object the link point is being added to fixes the problem. So my local fix was to simply swap two lines of T2D code.
Because you might want a link point on an object to which nothing was mounted I think this behavior is a bug.
I apologize for not having a minimal code to reproduce this, but I'll get that together when I can (its rather late right now).
What seems to be happening is the addLinkPoint("x y"); called the first time gets mangled when translating the coordinates. If called again with the exact same coords it is fine. Likewise, having an object mounted to the object the link point is being added to fixes the problem. So my local fix was to simply swap two lines of T2D code.
%this.weaponObject[%this.numberWeapons].weaponLinkPoint = %this.addLinkPoint($t);
%this.weaponObject[%this.numberWeapons] = missilelauncherObject::create("", %this, %weaponName, %location, %offset);becomes%this.weaponObject[%this.numberWeapons] = missilelauncherObject::create("", %this, %weaponName, %location, %offset);
%this.weaponObject[%this.numberWeapons].weaponLinkPoint = %this.addLinkPoint($t);Because you might want a link point on an object to which nothing was mounted I think this behavior is a bug.
About the author
#2
In other words, the object has been created, given a size, a position, etc., and not a timing thing for it being called right when the object is created?
(regardless I'm working on the minimal code in case it is a different problem.)
04/13/2005 (6:12 am)
As a clarification on the known problem would it cause the first add link point to be incorrect regardless of when in the life time it occurred as long as it occurred before a mount()?In other words, the object has been created, given a size, a position, etc., and not a timing thing for it being called right when the object is created?
(regardless I'm working on the minimal code in case it is a different problem.)
#3
So it's either a problem in my code or I haven't gotten it to the right minimal case yet. I'm still working on that.
04/13/2005 (7:20 am)
No minimal code at this time. And working on the other bug report I noticed that the tutorial did exactly what I'm saying wouldn't work right... I checked and it looks fine using an absolutely minimal case with either the non-OO or the OO executable.So it's either a problem in my code or I haven't gotten it to the right minimal case yet. I'm still working on that.
#4
I'm really sorry, Melv :(((
::Tim Doty
04/13/2005 (7:30 am)
Woops! I'm sorry, I'm batting 0.000 it seems... it was the result of incorrect parameter call to one of my functions -- that just happened to cancel itself when called a second time or with the switching of the two function calls.I'm really sorry, Melv :(((
::Tim Doty
Associate Melv May
If you don't think this describes your problem and if you can post some minimal code as you mentioned then I could look into it further.
Thanks for the report and in the meantime I'll bookmark it until you can post further code.
- Melv.