Sign in to follow this  
TobseN

Spawn a player correctly

Recommended Posts

Hey there,

if i spawn a player with "player.Position = new Vector3(x, y, z);" how can i set the camera behind the player?

is player.heading something like cameralookat?

 

Thanks

 

 

 

Share this post


Link to post
Share on other sites

Question isn't too clear.....

If you moved the player, then the camera is always behind the player anyway (when you're not in First person).

This is in C#, but method should be the same in JS.

https://github.com/horseyhorsey/RageMpClientBase/blob/d7c0e5c44b787870c03df46632365bf1a5cde4fa/src/RageMpClientHelpers/CamHelper.cs#L14

I've used this for a Shop menu. Disable player controls and point camera at the player without creating another camera. (Same as rotating camera with mouse or Pad Stick)

 

  • Like 1

Share this post


Link to post
Share on other sites

I am not sure if this solves the camera problem because I didn't had that, I just had the issue that the hud was not appearing.

My solution was just (in JS)

function spawnPlayer(player, position) {
	player.spawn(position;

	// for some reason I had still to set position sometimes to avoid issues and health
	player.position = position;
	player.health = 100;
}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.