How to make object or player do damage?


#1

Ok so I have been thinking on this for awhile and I wanna know how to make an entity do damage to another entity(model) so I wanna if theres some way I can learn or a project I can look at.I started this but eehh var enemy = pc.createScript('enemy'); var collider = collider; enemy.attributes.add('collider', { type:'entity' }); // this enemy is to die when touched// this.entity = enemy('player'); // this will take over a week to do // this.enemy = null;


#2

You will need to check for collision between two rigid bodies (enemy & player) and then reduce a health variable by a certain amount if collision is detected.

This tutorial will give you a basic understanding of Collision with Rigid Bodies:
Rigid Body Collisions