PDA

View Full Version : Is it possible for a colliding object to "push" the view?


Vmichaeljin
03-12-2006, 01:18 PM
Hi,

I'm trying to design an object that collides with the view and pushes it in the direction of the object's travel. Is there any way to get collision detection to do this for me?

Another related question is whether there is any way to "link" the movement of the view with the movement of a moving object. For instance, consider a traveling platform. If the view collides with the platform (as in, the viewer jumps onto the platform), I want then to link the view to the platform, so that if the view was not disturbed by the user, it would travel along with the platform. However, it should still be possible to move around on the platform if the user desires. What would be the easiest implementation strategy for this?

halley
03-13-2006, 07:01 AM
I'm just a Vizard user, but it appears that the answer to your first question is No. Vizard can tell if two objects are colliding, but the system would need to know (1) from what direction those two objects traveled to get there, and (2) in what direction the view should start looking or moving. You would have to make both of those decisions from the way your script works.

As for the second question, have you tried the .link() method? I am not sure if the argument to .link() has to be a motion sensor or it can be any compliant object, but try myviewpoint.link(myplatformobject) and see how it goes.

Personally, I would have an object which represents the actor, which gets moved around according to how the user commands, and also according to where the actor is standing in the environment. Then I would link the viewpoint to that actor. This seems to be a more flexible arrangement.

farshizzo
03-14-2006, 09:37 AM
Hi,

No, there is currently no way for an object to physically move the viewpoint, you would have to calculate this manually.

The best way to simulate a platform would be to create a timer when the user steps on to a platform, and then kill the timer when the user steps off. The code inside the timer would simply perform a relative movement of the view in the direction of the platform. Example:def StepOnPlatform():
#Start a timer

def StepOffPlatform():
#Kill timer

def ontimer(num):
if num == PLATFORM_TIMER:
v = platformVelocityVector * viz.elapsed()
view.translate(v.get(),viz.RELATIVE)The code above is just an outline. platformVelocityVector should be a vector describing the speed and direction that platform is moving in.