Page 1 of 1

How to aim the bullet correctly in Jbullet

Posted: Wed Feb 05, 2020 3:58 pm
by longboy9977vn
Im trying to implement jbullet in java, im facing a problem is, how to make capsule bullet correct way to the enemies.
I have try this solution [url] ... nother[url]
but it seem like not work at all
Screen Shot 2020-02-05 at 22.54.49.png
Screen Shot 2020-02-05 at 22.54.49.png (34.5 KiB) Viewed 756 times
i have try solution in this topic
[url] viewtopic.php?t=10443[url]
but it seem like some func not included in jbullet
like this

Code: Select all

btVector3 currentLook = rotation * localLook;
    btScalar angle = currentLook.angle(newLook);
thank you for your helping me in this, my english is bad so forgive me please

Re: How to aim the bullet correctly in Jbullet

Posted: Thu Feb 06, 2020 6:44 am
by longboy9977vn
For some one who faced with problem like this i have answer here

Code: Select all

shootBoxShape = new CapsuleShapeX(0.3f,0.5f);
Vector3f forward = new Vector3f(1,0,0);
Vector3f alignBullet = new Vector3f(destination.x - fromDestination.x, destination.y - fromDestination.y, destination.z - fromDestination.z);
Quat4f  q = startTransform.getRotation(new Quat4f());
			Vector3f CossVec = new Vector3f();
			q.x = CossVec.x;
			q.y = CossVec.y;
			q.z = CossVec.z;
			q.w = (float) (Math.sqrt((forward.lengthSquared()) * (alignBullet.lengthSquared())) +;