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.

Author
Message
Markswii
17
Years of Service
User Offline
Joined: 5th Aug 2007
Location: Object position x (mark)
Posted: 15th Mar 2008 18:04
I am creating a game in which I am mainly using dark physics I am at a point that has left me stuck for days. I want to create a bullet as a rigid body and when the mouse is clicked it should be positioned at the players position and rotated the same way the player is. I already have that but when I go to move the rigid body it moves only on the z axis dispite its rotation is there a way to fix this?

From the ashes of the first pc new breed of programmer is born. The TGC programmer can create a game in seconds with his mighty weapons of basic programming. (Is not an artist of any standards).
Codger
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 15th Mar 2008 22:53
As a bullet is generally fired directly away from you that would be the z plane, you did mean z plane and not z axis as that implies rotation?

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
Dewi Morgan
16
Years of Service
User Offline
Joined: 16th Jan 2008
Location: London, UK
Posted: 16th Mar 2008 14:23
As I understand the question (which may not be correct), you are doing something like:



And the "Move Object" is moving the BULLET object in the global Z direction, rather than the direction the player is facing?

I think to find the problem, you'd need to paste at least the bullet position, rotation and movement code.

Yet another programmer - http://www.thudgame.com/mmo
All my posts are Public Domain unless I say otherwise.
You may use all my code and ideas as you see fit.
Codger
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 16th Mar 2008 17:51
@Dewi
You may have correctly guessed the approach but, I'm sure you realize that to incorporate a bullet in DP you do not want to use the move commands instead apply force proportional to the relative distances from the "gun" to the target. The bullet should be a dynamic object or, as you cannot see a bullet anyway the effects can be faked using raycasting and the forces applied directly to the target.

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
Natflash Games
18
Years of Service
User Offline
Joined: 7th Feb 2006
Location:
Posted: 16th Mar 2008 18:23
This code will do what you want, suprisingly there is no phy move object in DP but this will work.

To create the bullet:



Then to move the bullet:



That code will work, I had the exact same problem as you and thats how I fixed it.


Check out my site for the latest on my games.
culmor30
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location: In my head.
Posted: 16th Mar 2008 18:25
Also, you could do what I did for my player object:



And in the loop:



Of course, you wouldn't need the sparky's commands I used, but that should give you a general idea. Make a normal DB sphere bullet and use a dummy phy object to follow it and have an effect on objects.
Airslide
20
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 19th Mar 2008 00:54
If you want fast moving bullets, I highly reccomend using a raycast instead of a rigid body. The raycast will determine what you hit and you can use the collision feedback (if your using sparky's for instance) to apply force at that position. You can of course use a rigid body for slow moving projectiles like rockets or rifle-grenades.

sindore
20
Years of Service
User Offline
Joined: 2nd Jul 2004
Location: Bedfordshire, UK
Posted: 14th Apr 2008 02:43
ok I think I can help here, here is a pace of code that I was working on about a year or so ago



hope it helps I've added a texture to sweeten the deal, if you use this image in your games please give me credit for it, thats all I ask, and if any one could help me with my problem witch I've posted at http://forum.thegamecreators.com/?m=forum_view&t=127692&b=30

hope this helps

From the dark and in to the light, twisted the body of madness, dark souls to only the one who would be called, Death lord of the dead, king of the forgotten, keep of lost souls.

Attachments

Login to view attachments
sindore
20
Years of Service
User Offline
Joined: 2nd Jul 2004
Location: Bedfordshire, UK
Posted: 14th Apr 2008 02:45
ok I think I can help here, here is a pace of code that I was working on about a year or so ago



[img]null[/img][img]F:\Projects\Physic's projects\bana01.jpg[/img]

hope it helps I've added a texture to sweeten the deal, if you use this image in your games please give me credit for it, thats all I ask, and if any one could help me with my problem witch I've posted at http://forum.thegamecreators.com/?m=forum_view&t=127692&b=30

hope this helps

From the dark and in to the light, twisted the body of madness, dark souls to only the one who would be called, Death lord of the dead, king of the forgotten, keep of lost souls.

Attachments

Login to view attachments
sindore
20
Years of Service
User Offline
Joined: 2nd Jul 2004
Location: Bedfordshire, UK
Posted: 14th Apr 2008 02:49
sorry I didn't mean to post this more than once had a bit of a glitch

From the dark and in to the light, twisted the body of madness, dark souls to only the one who would be called, Death lord of the dead, king of the forgotten, keep of lost souls.
sindore
20
Years of Service
User Offline
Joined: 2nd Jul 2004
Location: Bedfordshire, UK
Posted: 28th May 2008 02:39
hay Markswii I`v add a like to this post to my new physic & AI challenge post, I hope thats ok.

I wonted to add my flag image to the download as a incentive to my challenge post, but then I changed my mind to go with a no media challenge, so I just added a link to your post instead.

soul sucking devils, twisted body of the damed, slivering slim drips from ever poor, sin licking at your ears, and the smell stinging your eyes, and if you don't like it, get out of my kitchen!....
Nemasis
16
Years of Service
User Offline
Joined: 22nd Aug 2008
Location:
Posted: 22nd Aug 2008 09:29
Hi all

Im writing a space game in 3D and I want the camera to be able to rotate on its side left or right until upside down

can any one help me with sample code for this?

also when the camera is upside down the controls become inverted is there a code snippet that counters this

Login to post a reply

Server time is: 2024-11-24 23:12:55
Your offset time is: 2024-11-24 23:12:55