Enemy character disappearing

Everything worked well at first however when I changed the character’s placement in the editor, the enemy character disappeared a few seconds after launching the game. What happened there??:"))

Here’s the link to the game: PlayCanvas 3D HTML5 Game Engine

Hi @SHERENATA_BURAHAN!

No idea why the enemy is disappearing, but I see you use a dynamic rigidbody for your enemy entity. That means you can’t use rotateLocal() and translateLocal(). Instead you need to apply a force on the rigidbody of the entity. (Alternatively, you can make the rigidbody kinematic instead of dynamic but then the entity is not stopped by obstacles).

i kinda solved that part but now my problem is the character is levitated…I’m not sure anymore how to fix that

This may be caused by the dynamic rigidbody. The rigidbody can be effected by other entities and rotate the entity a bit.

I suggest to set the rigidbody type to kinematic and check the result again.

didn’t seem to work?? the enemy character is walking upwards (as if going upstairs)><

You use the player entity to look at. If the origin of the player is a little bit above the ground, the enemy will also look at that position and move a little bit into the air.

You can solve this with something like this:

var playerPos = this.player.getPosition();
var enemyPos = this.entity.getPosition();
this.entity.lookAt(new pc.Vec3(playerPos.x, enemyPos.y, playerPos.z));

where does this apply.?

It need to replace your current lookAt() code line, but you probably need to adjust the example code a bit because you use different naming for your player entity.

I tried it but then the orientation(??) kinda got messed up

Because you use this.entity.getPosition() instead of this.thePlayer.getPosition() for playerPos.

Again, please be aware all those things are not supported with a dynamic rigidbody.