Hi! I need help on my bullet direction. it just keeps going down when I shoot instead of forward/towards the target. i need to be right beside my object for it to be hit and disappear. Is this a code issue, or a bullet emitter and bullet issue in the scene?
Hoping anyone could help me! It’s a midterm project due on March 1st
Hi! What is the rigidbody on the pool? If dynamic, then change to kinematic, gravity can shift the trajectory
entityX. = entityX + (Math.cos(axisX) * 1);/*(number can be changed for bullet speed)*/ entityY = entityY + (Math.sin(axisY) * 1);/*(number can be changed for bullet speed)*/
i tried kinematic and it became an error
thank you so much!! but may i ask someone to convert it into scripts? sorry i’m no programmer at all
I got you
const thisEntity = new pc.Entity(); var bulletSpeed = 1 var rotation = thisEntity.rotation; var euler = new pc.Vec3(); rotation.getEulerAngles(euler); thisEntity.x = thisEntity.x + (Math.cos(euler.x) * bulletSpeed); thisEntity.y = thisEntity.y + (Math.sin(euler.y) * bulletSpeed);
I think this should work, if not than ask a moderator because PlayCanvas may be way more complex than I thought, but normal JS this would work 100% so I’m hoping this will
thank you so much! i put it in the fireBullet code but nothing happened. it didn’t necessarily error either
@DANIELLE_SABINE_LIM I don’t see a link to your project but it sounds like you are firing using physics rather than raycasting. If this is the case then here is a project you could have a look at.
Also, this seems to be a common question on the forum. Here is a search link which may give you more ideas.
Hope this helps.
hmmm, yeah u need someone more skilled, I don’t fully know how playcanvas works @Tirk182 ?