plz help me with it i looked at other disscusions it did not help
Hi @XZAYDEN_MARTINEZ and welcome! There are several ways to do this. Did you already try to use a trigger?
https://developer.playcanvas.com/en/tutorials/collision-and-triggers/
https://developer.playcanvas.com/en/user-manual/physics/trigger-volumes/
hy Albertos i have tried but i don’t understand it
also can you help me with random world genration here is my leangh i don’tknow what i am doing wrong thanks XZAYDEN_MARTINEZ
Which entity in your project do you want to pick up? This entity need a collision component and a script component.
iron stick
Create a new script with the name ‘trigger’ and replace the code with the code below. Save the script. Add the script to the script component of the entity. Launch the game to see if it does something.
var Trigger = pc.createScript('trigger');
// initialize code called once per entity
Trigger.prototype.initialize = function() {
this.entity.collision.on('triggerenter', this.onTriggerEnter, this);
};
Trigger.prototype.onTriggerEnter = function(entity) {
if (entity.name === 'Player') {
this.entity.reparent(entity);
}
};
it works by it appers in the sky
You didn’t create a new script with the name ‘trigger’, so the actual script name is conflicting with the script name in your code.
Probably it takes over the height of your player because we made it a child of your player, but I’m not sure.
I think you mean it does not rotate with the camera? Maybe you can make it a child of your camera instead of your player.