OnCollision question
by Kurt · in Torque Game Engine · 05/15/2003 (6:42 pm) · 4 replies
I have the following code an OnCollision callback in script of a static object type. When the player hits the object, I create a lifter object (very small sphere) and set it's transform to be the same as the static object. Only problem is that it is created offset from the static object. I was hoping the object would roughly be in the same position as the static object. Am I missing something trivial here?
function Ladder::onCollision(%this,%obj,%col,%pos)
{
%lifter = new Lifter()
{
dataBlock = up;
};
%pos = %obj.getTransform();
%lifter.setTransform(%pos);
......
......
}About the author
#2
When in the editor view, you should be able to see both 'models' and bounding boxes.
-If your sphere has no visible model, it might be that the mount point is very much displaced from the object transform handle. Or even the object transform handle might be very much displaced from the rest of the model.
-If one of the bounding boxes does not comply with the object it might also be the net-code where one object has different locations for the client and the sever. However in this case both object-boxes should be at equal location.
-If both object-boxes and not at equal locations and tranforms are. While models are equal (this is a nice way to test things), there would have to be an problem in the dynamic object code.
I know from experience that you'd have to interpret transforms differently if you want to dynamically move objects.
Ofcourse I haven't looked at the dynamic code to know if it's flawwed in this way.
Eitherway.. a screenshot of the dislocation would do wonders to clear stuff up...
Alternetivly.. I could hook you up with an different dynamic move code that works for any object... but first it might be interesting, at least, to find out what the problem is.
05/26/2003 (11:16 pm)
Maybe you could run down the follow list of checks.When in the editor view, you should be able to see both 'models' and bounding boxes.
-If your sphere has no visible model, it might be that the mount point is very much displaced from the object transform handle. Or even the object transform handle might be very much displaced from the rest of the model.
-If one of the bounding boxes does not comply with the object it might also be the net-code where one object has different locations for the client and the sever. However in this case both object-boxes should be at equal location.
-If both object-boxes and not at equal locations and tranforms are. While models are equal (this is a nice way to test things), there would have to be an problem in the dynamic object code.
I know from experience that you'd have to interpret transforms differently if you want to dynamically move objects.
Ofcourse I haven't looked at the dynamic code to know if it's flawwed in this way.
Eitherway.. a screenshot of the dislocation would do wonders to clear stuff up...
Alternetivly.. I could hook you up with an different dynamic move code that works for any object... but first it might be interesting, at least, to find out what the problem is.
#3
Those are some really solid points.
I am leaning towards your last point about the transforms being equal yet the objects boxes are not located in equal positions. I will check this tonight.
How do I have to interpret transforms in this scenario? I too would like to
get to the bottom of this. I will send you a screenshot tonight.
Thanks,
Kurt
05/27/2003 (7:38 am)
Sebastian,Those are some really solid points.
I am leaning towards your last point about the transforms being equal yet the objects boxes are not located in equal positions. I will check this tonight.
How do I have to interpret transforms in this scenario? I too would like to
get to the bottom of this. I will send you a screenshot tonight.
Thanks,
Kurt
#4
05/29/2003 (7:10 am)
Okay, figured it out. Modeling error. Much props to Sebastian for lighting the way.
Torque Owner Kurt