Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, dBc), 18,430 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Force an object to be in front of the player? #367634
04/15/11 19:47
04/15/11 19:47
Joined: Aug 2007
Posts: 74
Mahdi Offline OP
Junior Member
Mahdi  Offline OP
Junior Member

Joined: Aug 2007
Posts: 74
hi,

I asked so many noobish questions for a while. sorry for that.

I need to place an entity pointer in front of player face. so when player rotates, It rotates too but it should still stay in front of player face.

currently I use vec_set to place an entity in front of player face. but when player rotates, the entity does not stay in front of player's face.

could U understand what i mean?

Is there anyway?


I don't care!
Re: Force an object to be in front of the player? [Re: Mahdi] #367635
04/15/11 20:04
04/15/11 20:04
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
rotate your vector you use in vec_set!

VECTOR pos;
vec_set(pos,vector(x,y,z)); //your position here:
vec_rotate(pos,player.pan);
vec_add(pos,player.x);
vec_set(object.x,pos);


Visit my site: www.masterq32.de
Re: Force an object to be in front of the player? [Re: MasterQ32] #367639
04/15/11 21:14
04/15/11 21:14
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Or even simpler:

Code:
action thinginfrontofplayer()
{
	while(1)
	{
		my.x = sin(player.pan) * 64 + player.x;
		my.y = cos(player.pan) * 64 + player.y;
		my.z = player.z;
		wait(1);
	}
}



... where 64 is the distance from the player to that object.


Always learn from history, to be sure you make the same mistakes again...
Re: Force an object to be in front of the player? [Re: Uhrwerk] #367665
04/16/11 11:04
04/16/11 11:04
Joined: Aug 2007
Posts: 74
Mahdi Offline OP
Junior Member
Mahdi  Offline OP
Junior Member

Joined: Aug 2007
Posts: 74
Thanks. both of them is something that i need. But Uhrwerk solved the current case easily (as always!).

Thanks again.


I don't care!
Re: Force an object to be in front of the player? [Re: Mahdi] #367670
04/16/11 11:42
04/16/11 11:42
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
but uhrwerks way has some small problems:
you can never use tilt or roll!
his script only uses pan, so maybe you can get problems if your player tilts!
but if not, then it's okay


Visit my site: www.masterq32.de
Re: Force an object to be in front of the player? [Re: MasterQ32] #367681
04/16/11 15:55
04/16/11 15:55
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
my.x = player.x + 200 * cos(player.pan);
my.y = player.y + 200 * sin(player.pan);
my.z = player.z + 200 * tan(player.tilt);


That would work on something if you needed it to be in front of the player and the player could fly or something comparable.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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