2 registered members (TipmyPip, AndrewAMD),
12,726
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: How do I make a camera rotate with an entity as it's center? :)
[Re: Max_Prower]
#256589
03/17/09 17:27
03/17/09 17:27
|
Joined: May 2008
Posts: 331 Lithuania, Vilnius
Jaxas
Senior Member
|
Senior Member
Joined: May 2008
Posts: 331
Lithuania, Vilnius
|
You can find code in forum, but what the heck, here's the basic that you'll need: camera.x = player.x-distance* cos(camera.pan); camera.y = player.y-distance* sin(camera.pan); Experiment with other camera values your self 
The smaller the bug, the harder it is to kill. _________________________________________ Forklift DEMO (3dgs)
|
|
|
Re: How do I make a camera rotate with an entity as it's center? :)
[Re: Max_Prower]
#256592
03/17/09 17:43
03/17/09 17:43
|
Joined: Mar 2009
Posts: 8
Sonne
Newbie
|
Newbie
Joined: Mar 2009
Posts: 8
|
camera.x = me.x + fcos(my.pan,-1 * distance); camera.y = me.y + fsin(my.pan,-1 * distance); vec_diff(temp.x,me.x,camera.x); vec_to_angle(camera.pan,temp.x); I found that in one of the tutorials on the wiki. Works for me. I too have to resolve the camera going into walls which I believe was also addressed in those tutorials but I haven't looked into that portion yet. Wiki Tutorials
|
|
|
Re: How do I make a camera rotate with an entity as it's center? :)
[Re: Max_Prower]
#256698
03/18/09 13:23
03/18/09 13:23
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
Trigonometry and vector/matrix algebra are the principles that 3D graphics are built up off. Without an understanding of them its pretty hard to fully appreciate what is going on. If you're not that comfortable with maths or just have gaps in your knowledge then i recommend a maths book. I have used this book and it helps alot... 3D maths primer for 3D Graphics/Games. http://www.amazon.com/Primer-Graphics-Development-Wordware-Library/dp/1556229119
|
|
|
Re: How do I make a camera rotate with an entity as it's center? :)
[Re: DJBMASTER]
#256762
03/18/09 21:34
03/18/09 21:34
|
Joined: Sep 2008
Posts: 76
Max_Prower
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2008
Posts: 76
|
I'm not an adult and don't have my own money to be able to spend on the net. Are there any free resources?  And I manged to find a solution. I used the camera script from David Lancaster's Kindom Hearts tutorial. Here is what I used (I tinkered with the values a little). vec_set(camera.x,vector(my.x + fcos(my.pan,-466),my.y + fsin(my.pan,-466),my.z +
160));
vec_diff(temp.x,my.x,camera.x); //make the camera look towards the player
vec_to_angle(camera.pan,temp.x);//place the camera behind the player
}
Last edited by Max_Prower; 03/22/09 13:14.
|
|
|
|