About Store Forum Documentation Contact



Post Reply 
Player spawn issues
Author Message
zeph2 Offline
Member

Post: #1
Player spawn issues
Im using default tutorial #14 camera modes main to spawn a character in a world that has multiple height maps.. Player spawn will only spawn near the 0x 0y coordinates, which works well, but when I move the character to a different location on map to change spawn point, player does not move, and camera position is set at 0x 0y position on load. A year ago I was able to change the player start spawn location.. I tried all the tutorials on basic movement, and all them are doing this..

Has anything changed since a year ago?
(This post was last modified: 05-03-2016 11:17 PM by zeph2.)
05-03-2016 09:55 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: Player spawn issues
Sounds like the object is out of world active range.

You need to call Game.World.update(pos); with position so that the player is in that area.
05-03-2016 11:25 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #3
RE: Player spawn issues
Please see here for more info:
http://www.esenthel.com/?id=doc#World_Manager
05-04-2016 12:05 AM
Find all posts by this user Quote this message in a reply
zeph2 Offline
Member

Post: #4
RE: Player spawn issues
What is the world active range distance wise? I have several heightmaps stitched together.

Im just using the default player dragged into the scene on map at the desired start location for now until I get a create player script going, and player select spawn location.

I did a search and it seems like Im having this issue located here. Except I am not teleporting, I just want a desired location other then (0, 0, 0) on game start up.

Seems like the default .pos(0, 0, 0) is used for the camera no matter where I drag and place the obj player character into the scene unless its near the default .pos(0, 0, 0) then it attaches to the player correctly.

wouldnt void pos (C Vec &pos 0,0,0 ); work in negating the default position?
05-04-2016 12:50 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #5
RE: Player spawn issues
To change world active range please see Game.World.activeRange.
Default value is 100 meters
05-04-2016 02:20 AM
Find all posts by this user Quote this message in a reply
zeph2 Offline
Member

Post: #6
RE: Player spawn issues
I understand now bout distance thanks for pointing that out but what I tried doesnt seem to be working.

bool Update() // main updating
{
if(Kb.bp(KB_ESC))return false; // exit if escape on the keyboard pressed
//player.update(); // update player
//Cam.setSpherical(player.ctrl.actor.pos()+Vec(0, 1, 0), player.angle.x, player.angle.y, 0, Cam.dist*ScaleFactor(Ms.wheel()*-0.2)).updateVelocities().set(); // update camera according to player angles and mouse wheel
// Game.World.update(5954.6,47.5,38291)
Game.World.update(Cam.at=pos(5954.6,47.5,38291));
UpdateCamera();

return true; // continue
}
05-04-2016 03:01 AM
Find all posts by this user Quote this message in a reply
zeph2 Offline
Member

Post: #7
RE: Player spawn issues
Im a little lost.. I did this and received an error

Game.World.activeRange(6000);
Game.World.activeRange(D.viewRange(6000)) //This works but all i see is sun and skybox no land
05-04-2016 04:35 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Online
Member

Post: #8
RE: Player spawn issues
why would you do the world update like that ?

you should simply call your camera position
like in basic inesis you can see
Game.World.update(Cam.at);

and then you can just change your character position and the cam position linked to it.
(This post was last modified: 05-04-2016 05:51 AM by RedcrowProd.)
05-04-2016 05:48 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #9
RE: Player spawn issues
init:
Code:
flt range=1000; // don't set this too high or you will have low performance
D.viewRange(range);
Game.World.activeRange(range);

when creating a player character:
Code:
Vec player_pos=..;
Game.World.update(player_pos); // this will load areas around 'player_pos'
createNewObjectAtPosition(player_pos); // here insert the player at 'player_pos'
05-04-2016 06:06 AM
Find all posts by this user Quote this message in a reply
Post Reply