get-location

I've created a custom shape mobile object and would like to know the location of a specific spot on the agent as it moves around the environment. Is there some way to modify the get-location function to do that? THanks!

get-location

You could override the method get-location to provide you with the custom information you need. If the shape is rotating, you'll want to transform the vector by the agent's rotation to get the location in world coordinates

- jon

get-location

I don't know how to over-ride the method, could you give me a few pointers? thanks!

get-location

Actually, get-location will return world coordinates. Specifically, it will return the world coordinates of the center of the object. If you want a point different from the center -for instance, a point in one of the sides of a cube- only then will you need to use the get-rotation method.

This is what I'm currently using:
myPoint = ((self get-location) + (self get-rotation)*(0.0,1.0,0.0)).

Basically, in this example (0.0,1.0,0.0) is the vector that specifies the position of the vertex you are interested on, you then rotate it according to your object's current rotation, and translate it according to the object's current position. The result is stored in myPoint

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.