firing using phent_addcentralforce ??

Posted By: dracula

firing using phent_addcentralforce ?? - 01/25/09 15:45

I have a simple function that uses phent_addcentralforce() to fire an object. I want to fire it from a FPS view ie from the camera. I just can't figure it out.

Does anyone have some code for this please ?

Thanks

Drac.
Posted By: croman

Re: firing using phent_addcentralforce ?? - 01/25/09 16:07

create your bullet in camera position, little bit in front of it and then apply force to the bullet. it should be that simple wink
Posted By: dracula

Re: firing using phent_addcentralforce ?? - 01/25/09 16:38

I can do this but when I pan or tilt the camera, the bullet fires from the orginal position.

Can someone please give me some code to work with.


Thanks
Posted By: dracula

Re: firing using phent_addcentralforce ?? - 01/25/09 20:43

This is more tricky than you think because c_trace (as I have used before) uses a direction vector where as phent_addcentralforce uses force.
Also, I am not using a model, just the camera co-ordinates

Thanks

Drac.
Posted By: EvilSOB

Re: firing using phent_addcentralforce ?? - 01/26/09 02:08

Remember to rotate your antity and phent_addcentralforce vector
by the cameras pan, tilt, and maybe roll?
Posted By: dracula

Re: firing using phent_addcentralforce ?? - 01/26/09 15:08

Good idea, sadly I still can't do it.

Thanks
Posted By: zwecklos

Re: firing using phent_addcentralforce ?? - 01/26/09 15:17

Hi there,
You have to use "phent_addvellocal" instead of "phent_addcentralforce".

This will add force dependent to the bullets orientation (pan, tilt, roll).

cheers

Zwecklos
Posted By: dracula

Re: firing using phent_addcentralforce ?? - 01/26/09 19:20

Hi Zwecklos

It worked perfectly, thank you so much !

Drac.
© 2024 lite-C Forums