Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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 | chip programmers | 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