I was trying to make a reflect script for my sword weapon in my game so that when you right click and a bullet object is in a trigger it would change the bullet’s direction.
It’s not working because the bullets is not being registered as being within the trigger. I have no idea on how to fix this.
Project: PlayCanvas 3D HTML5 Game Engine
Its in the scene debug 2
Scripts:
Scripts/player/weapons/melee/sword.js
scripts/enemy/bullet.js
Entities:
player/camera/sword
player/camera/sword/reflect
I don’t see a bullet entity in your scene hierarchy.
To activate a trigger the other entity need to have a rigidbody and collision component. Personally I don’t use bullets with a rigidbody component, so my bullets are actually triggers.
oh i was using ur enemy script and it would spawn in and head towards the player
but i think it not having a rigidbody is the issue
The reason why I don’t use a rigidbody component on a bullet is because with a rigidbody component the bullet will push other dynamic rigidbodies away.
do you have any ideas on how to do the reflect with the triggers?
Also be aware triggers are not a activated by static rigidbodies.
I’m not sure what is the best solution in your case. I can imagine you also can’t give the sword a kinematic rigidbody.
I’ll just see if doing a regular raycast could work, my only worry is that it would be too hard to hit the bullet