Jump to content

Unmount issue


Recommended Posts

My player needs rest so I provided a bed. Interact with bed, you get mounted in sitting pose and pops a dialog to get up.

When you click the get up button it calls this:


function serverCmdDoneBed(%client)

{

%client.player.bedrep = 0;

%client.player.unmount();

%bed = %client.player.bed;

%client.player.bed = 0;

%spawn = "bedSpawn"@%bed;

%client.player.setTransform(%spawn.getTransform());

%client.player.isMounted = false;

}


I have a player spawn point called bedspawn1,2,3 etc all is well at this point.

If the player sits on the bed again and gets up, they fall through the floor. Can be repeated and the spawn point is way above the floor.

I have this same issue with a vehicle if I get in then out then in and back out I fall through the land.

It's almost like the engine loses track of position or collision is lagging a update or it's not cleared. Been looking in the engine but can't see where it happens.

anyone encounter this issue ?

Link to post
Share on other sites

Why do you respawn the player out of the bed anyway? Is it not enough to just change the mount and animation?


For spawning you should always spawn things above to where you want them spawned, so you have a little buffer zone that prevents glitching through the floor, if you already have that the problem may be somewhere else.


Also it may depend on the physics engine you use, I had problems with PhysX and Bullet before. For example one issue was that when I fire my weapon and run forward, the player somehow managed to run faster than the bullet and the bullet would hit him, causing damage to yourself.


But I can just guess here, a video or so would probably help much, to me it just sounds you are doing things too complicated. I mean if you really want to respawn the player near the bed, then you can manually place a spawn that works I don't see the problem there. Maybe the animation messes up the collision box and that is why you glitch through.

Link to post
Share on other sites

When you say 'way above the floor' could you quantify that? also, you should be able to just set an actual position and teleport the player without a spawn point, as long as you have a small clearance above the floor object. Is the effect occurring *during* the animation at a particular spot? or before or after?

Link to post
Share on other sites

Using basic physics. As I said it works once but if I mount back to the bed without moving and get up again player falls through. I am using a spawnsphere with one meter size. the bottom point of the hedron is like 0.1 m above the floor. If I just do a unmount the player is standing in the middle of the bed so I needed to move him away.

How do I post a direct image here? I.E. no url

Link to post
Share on other sites

Uh do you use the default spawn function where it spawns you in a random location inside the spawn sphere? Either change the function or much easier just change the spawn sphere size to something very small, so there is less variation. The polyhedron is just a model to symbolize the spawn sphere, the green sphere is what defines where the player spawns.


I have not thought about the problem of the player standing in the middle of the bed, if you just unmount. Can't think of a good solution right out of my head now for that, maybe one thing, did you know you can make animations offset from the models origin? So you can make an animation where the player goes to bed, without actually changing the players location. At least I think that's possible. Similar to the death animation where the player falls over, but the models origin is still where his feet were before he fell, so you can make a go to bed animation similar like that.

Link to post
Share on other sites

Just from memory, I recall the engine does a lot of things along the lines of...


obj->disableCollision();

… do stuff....

obj->enableCollision();


...when certain checks are made. IIRC, you can look at the collision code in 'Item' to see an example of this. I remember trying to get some immediate updates on collision before, and what ultimately nailed it down for me was calling updateWorkingCollisionSet() on the Player object. I believe I even went so far as to make an EngineMethod out of it and calling it from script when I had to.

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.

×
×
  • Create New...