Gamestudio Links
Zorro Links
Newest Posts
What are you working on?
by rayp. 11/20/26 18:10
FXCM => AVA Trade Plugin???
by Martin_HH. 11/17/26 17:02
contractUpdate() is filtering if >2 rows
by mistery. 11/09/26 12:06
New Zorro version 3.15
by jcl. 11/09/26 09:24
Removing outliers from files
by jcl. 11/04/26 10:30
[MED] Import from FBX (2010) missing!!!
by rayp. 11/03/26 14:33
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (AndrewAMD, Quad, LucasJoshua, 1 invisible), 43,432 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rht, MaliceTheMaker, Haitao_Ren, JimSimons, julienp
19249 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Concerning the camera code in workshop 24 #316384
03/23/10 18:21
03/23/10 18:21
Joined: Oct 2009
Posts: 49
L
Lecithin Offline OP
Newbie
Lecithin  Offline OP
Newbie
L

Joined: Oct 2009
Posts: 49
I understand all of the functions in the code below but I have a question regarding the ENTITY pointer.


I understand that the function camera_follow is assigned to ENTITY* ent but how does Gstudio know which entity is ent? There are multiple entities, why does the camera follow your wizard and not the other?

Code:
function camera_follow(ENTITY* ent)
{
	while(1) 
	{
		vec_set(camera.x,vector(-150,10,50));  // camera position relative to the player      
		vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
		vec_add(camera.x,ent.x);      // add player position
		vec_set(camera.pan,vector(ent.pan,-10,0)); // look in player direction, slighty down      
		wait(1);
	}
}



Re: Concerning the camera code in workshop 24 [Re: Lecithin] #316389
03/23/10 19:04
03/23/10 19:04
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
the wizard has, if i am right, an action.

in this action the entity pointer "me" is valid for the model which has the action assigned.

In this action the function camera_follow is called. It overgives the pararmeter which entity should be followed. That means, if an action calls camera_follow and overgives the me/my parameter the camera will follow the entity wink

camera_follow(me); //in the action of the model which the camera should fllow

Re: Concerning the camera code in workshop 24 [Re: Rei_Ayanami] #316407
03/23/10 20:45
03/23/10 20:45
Joined: Oct 2009
Posts: 49
L
Lecithin Offline OP
Newbie
Lecithin  Offline OP
Newbie
L

Joined: Oct 2009
Posts: 49
wow I feel like an idiot. I got so caught up on the camera code that I forgot about the action that is called later...

Thanks for your explanation, if I understand it correctly, it's just passing the me to the camera so that the me entity is the same me as the action that originally assigned it.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1