Quick question could i use a box/cube to use the collision to make my character pick up the weapon? I will edit anymore questions and detail when i learn more about it
EDIT: Well i kinda went through and i came up with this:
var Weapon = pc.createScript('weapon');
// initialize code called once per entity
Weapon.prototype.initialize = function() {
this.terrain = this.app.root.findByName('terrain');
this.safe = true; //Safe is used to determin if the weapon will kill someone or not.
this.owner = "";
this.entity.collision.on("collisionstart", this.onCollisionStart, this);
};
// update code called every frame
Weapon.prototype.update = function(dt) {
if(this.entity.getPosition().z !== 0.5 && this.entity.getParent() == "Weapons"){
this.entity.setPosition(0, 5, 0.5);
console.log(this.entity.getPosition());
}
};
Weapon.prototype.onCollisionStart = function(result) {
if(result.other.getName() === "terrain") {
this.safe = true;
this.owner = "";
}
};
But still the weapon does not attach to the entity
Ps, would you like help with this game? I can help out! We can publish under my Game Studio, Renegade Lab Studios. We could also publish it to an upcoming game jam!
No i dont have a working phone or skype right now i got to get my screen replaced this is my only solution right now:
Ok so when i did that it said that the graphnode was already parented:
could this be why?
Well @yaustar i am trying to remove the parent from ¨Root¨ and make the parent the ¨Player¨ onCollision so when the player collides the player is now the parent of the weapon. Am i making sense?
EDIT: Here is project in case you want to look