#### Archived

This topic is now archived and is closed to further replies.

# Camera and target moving algorithm

This topic is 5892 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Does anyone know a good, smooth algorithm for moving the camera and its target (in 3D)? Let''s say that the camera is following an object (in chase-cam) and I want it to move to another location and follow another object instead. What would be a good way of doing so? Do you think that the movement and turning should accelerate (up to a certain speed limit) or do you have another approach? I''m grateful for any help on this subject.

##### Share on other sites
you can use quaternions if you want to have some advanced camera movement, but if you''re making a fps, or anything other than a space/flight sim, you probably won''t need that. if you do, search google or these forums, i''m sure u''ll find a lot of good stuff.

if you want to have smooth camera trasitions between two objects, i suggest you either wait for some1 else to reply, or read some book on physics, especially the acceleration/speed/velocity/vector topics. once you got that covered, make a simple sphere accelerate on the screen. make it so that it accelerates in whatever direction you want it to (use arrow keys). then try making so that it has a speed limit, add friction, etc. etc. just play around with it. then try making an algorith that would smoothly move an object from one position to another (it''s always easier to start w/ moving objects, than w/ cameras).

anyway, good luck.

---
shurcool
wwdev

##### Share on other sites
Thank you for your comments. I've begun to make an object that moves from one location to another, but I'm still not satisfied. I'm disregarding rotation, the actual camera will have the ability to look in one direction and accelerate in a completely different direction, so I can have the movement done as I want it first.

I've come up with some equations that must be satisfied. y(t) is the position at time t, y'(t) is the velocity at time t, y"(t) is the acceleration at time t. Current time is 0 and the time when arriving at the desired location is 1.

y(0) = 0
y'(0) = a

y(1) = b
y'(1) = 0

What should the acceration y"(t) be for 0 <= t <= 1?

I also have two integrals that I'm unsure if they are any help, or if they are appliable.

1
∫ y'(t) dt = b
0

1
∫ y"(t) dt = -a
0

[edited by - dalleboy on August 31, 2002 1:57:49 PM]

1. 1
Rutin
25
2. 2
3. 3
4. 4
5. 5

• 10
• 13
• 19
• 14
• 9
• ### Forum Statistics

• Total Topics
632942
• Total Posts
3009344
• ### Who's Online (See full list)

There are no registered users currently online

×