Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (vicknick, AndrewAMD), 1,292 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | 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