1 registered members (AndrewAMD),
1,089
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Smart camera.pan changing
#383682
09/23/11 18:02
09/23/11 18:02
|
Joined: Sep 2010
Posts: 42 NS, Canada
gSet
OP
Newbie
|
OP
Newbie
Joined: Sep 2010
Posts: 42
NS, Canada
|
Here's something I've been struggling with for some time. I've got a function that, when passed 5 args (x, y, z, pan, tilt) it smoothly moves the camera to that position. X, Y, Z and Tilt were easy, assuming you're never looking upside down. I did those by dividing the remaining distance to the goal by the original distance to the goal, multiplying by 180, and using the sin as a velocity factor in each cycle.
The hard part is doing something like this with the pan. The difficulty arises from the fact that 359 and 1 are actually closer than they would mathematically seem... I need it to detect which direction (left vs right) it should be turning based on how "far away" the final pan is from the current pan.
Any ideas would be GREATLY appreciated!
"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
|
|
|
Re: Smart camera.pan changing
[Re: Superku]
#383872
09/26/11 15:28
09/26/11 15:28
|
Joined: Sep 2010
Posts: 42 NS, Canada
gSet
OP
Newbie
|
OP
Newbie
Joined: Sep 2010
Posts: 42
NS, Canada
|
Awesome - this function is incredibly useful for this sort of thing! I had a big ugly pile of if statements to try to determine the direction that should be used, but they didn't even work properly.
"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
|
|
|
Re: Smart camera.pan changing
[Re: gSet]
#383873
09/26/11 15:33
09/26/11 15:33
|
Joined: Sep 2010
Posts: 42 NS, Canada
gSet
OP
Newbie
|
OP
Newbie
Joined: Sep 2010
Posts: 42
NS, Canada
|
Hm.. Actually, it turns out I must have implemented this improperly. Are you able to give me an example of how this function should be used to shift the camera from its current pan to a given pan?
"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
|
|
|
Re: Smart camera.pan changing
[Re: Superku]
#383876
09/26/11 15:53
09/26/11 15:53
|
Joined: Sep 2010
Posts: 42 NS, Canada
gSet
OP
Newbie
|
OP
Newbie
Joined: Sep 2010
Posts: 42
NS, Canada
|
Thanks - I had checked the manual, I just hadn't made the connection of how to use this shift to move the camera in the proper direction. This seems to work perfectly.
"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
|
|
|
|