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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.