Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / throw an object, help please.

Author
Message
david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 4th Oct 2006 06:07
I want to be able to place a ball at my current location and then just throw a ball out there.

like a simple stone throw.

The problem I have is there is no simple way to do this that I can see.

this is what I have so far.



I am not getting how to use the linear velocity to just make my object move in the direction it is facing.

This is driving me nuts, I know it has something to do with the angles and stuff but everything I try just doesnt get it to work properly. All the examples I have from the demo's and help are using linear velocity from a fixed/stationary camera. not a moving one.

I sure need some serious help on this. cause its gonna break my game if I cant figure this out. Thank you.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 4th Oct 2006 06:10
have alook at this may help you it in code sinppets.


http://forum.thegamecreators.com/?m=forum_view&t=86297&b=6

Dark Physics makes any hot drink go cold.
david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 4th Oct 2006 06:16
Ok thats neat. But what I need is basically, to determine the x,y,z, force I need to apply on my object, so that It moves in the correct direction.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 4th Oct 2006 06:34
try adding the bottom line to the code



Dark Physics makes any hot drink go cold.
david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 4th Oct 2006 07:46
it doesnt work
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 4th Oct 2006 15:16
heres the code with the line added, when you let go of the object you will that it shoot off into the ground quicker, change the values till you get the look your after.

This just code so that you can see how a command reacts then you know what values to used in your main code.




Dark Physics makes any hot drink go cold.
bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 4th Oct 2006 22:48
i cheated...i placed a ball at the camera position set it's orientation to the camera moved it forward 1 unit took the difference from the camera and the objects current position on x,y,z this will give you the value to multiply your force by to fire it in that direction (make the ball a physics object after you move it and before you apply your linear velocity)

david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 4th Oct 2006 23:08
@bosskieth

I understand what you are doing and have already thought of that stuff, but what I dont understand is how you are calculating your forces. you need 3 forces, force x, force y and force z. and these will always keep changing each time you move your player around the level. The angles are always changing. If you can explain or show me some code as to have you solved this then I would really appreciate that. thank you.
bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 5th Oct 2006 00:05
you multiply the unit distance traveled by the sphere on each of the axis it moved. Because you moved it 1 unit it's new positions differences on all the axis will result in a vector of 1 unit...therefore you can multiply your desired force by the delta of all 3 axis.


david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 5th Oct 2006 01:53
its not quite working correctly.........here is my code that I have




any ideas??
bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 5th Oct 2006 03:04
do you have a character controller that may be so large that it interferes with the ammo objects? If the objects created overlapping the character controller it will alter it's angle. try activating phy debug and the debugger to see if it is created overlapping your controller. that code was pretty much copied out of my demo so i know it does work.

david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 5th Oct 2006 05:43
@bosskeith,,,well your right my character controller is interfering with my ability to throw, it keeps hitting it and going bouncing off at random angles. LOL, well not really LOL, cause its been a heck of a time fighting with this, when the whole time it seemed like the code was good,(and it was), just have to adjust my character controller and I'm good. Thanks for all the excellent help.
bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 5th Oct 2006 14:03
glad i could help

Login to post a reply

Server time is: 2024-04-25 14:54:45
Your offset time is: 2024-04-25 14:54:45