3D Rad - Free 3D game maker - Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Coming soon: software updates

Author Topic: Turret controlled by mouse  (Read 198 times)

galaxie500

  • Newbie
  • *
  • Posts: 4
Turret controlled by mouse
« on: November 01, 2009, 01:13:23 PM »
Hi everybody!

First of all, I have to say that 3Drad is one of most impressive piece of software I've ever seen. So much power is packed in such a small file size. It caught my attention when it became free and I got hooked and I decide to try to make my first game. I've been following this forum on everyday basis ever since, trying to learn as much is possible before asking first question.

I want to make naval sim game and for that I need turret with gun controlled by mouse: mouse left and right controlling the azimuth of turret while up and down controls gun elevation. I've managed to make azimuth control but gun elevation control is givin' me the headache. Look at attached file and you will see what I mean.
I assembled them on a car object because it's easier for upload but principle are the same for my ship turret.

Maybe, if I may suggest, turret can be made as standard rigidbody object controlled by mouse. You simply drop them to any other object like car, boat... and you have instant tank, battleship etc.

I'm trying to learn scripting but it is hard for me because my english is not that good and it's hard for me to understand some of the functions. Mike has started nice scripting school in one of the forum threads but unfortunately ended to soon for me.

Anyway thanks in advance for any help.

PS. Mike, thank you for your infinite ocean plugin and your submarine looks absolutely amazing. It's your work and cool_blue_sapphire's ships that hooked me to 3Drad.

Logged

galaxie500

  • Newbie
  • *
  • Posts: 4
Re: Turret controlled by mouse
« Reply #1 on: November 02, 2009, 02:16:04 PM »
Hi everybody,

Well, I made some progress on making my turret. I've managed to control both azimuth of turret and elevation of gun with mouse but both turret and gun behave rather quirky, especially gun. I think that I can't solve that problem but for me this is already big achievement. Also I added a targeting camera but without zoom at this moment. See for yourself.

I hope that someone else have another approach to my problem.   
Logged

3D Rad Developer - Fernando

  • Administrator
  • 3D Rad Guru
  • *****
  • Posts: 3788
Re: Turret controlled by mouse
« Reply #2 on: November 02, 2009, 02:26:51 PM »
It runs smoothly for me. And the targeting camera is real cool  :)

Daniel Cremers

  • Sr. Member
  • ****
  • Posts: 483
    • WWW
Re: Turret controlled by mouse
« Reply #3 on: November 02, 2009, 03:04:22 PM »
Cool demo!
Logged
I come, I see and I go away

galaxie500

  • Newbie
  • *
  • Posts: 4
Re: Turret controlled by mouse
« Reply #4 on: November 02, 2009, 03:36:41 PM »
Hi everybody,

Fernando, by quirky movemement I mean that when you rotate turret, gun follows as it should be, but when you stop rotating the turret, the gun still moves for a few degrees in same direction and then turn backwards and then stops where it should be. Both turret and should be firmly attached to car and to each other so there shouldn't any post movement.

And one more thing is problem to me. How can I restrict movement of a gun in interval let say -10 +60 degrees. Limiting joint angular limits doesn't work.

And for a fun I added few things so you should try to shoot ball while driving around. This is first 3Drad armored beetle. BEWARE!

Logged

3D Rad Developer - Fernando

  • Administrator
  • 3D Rad Guru
  • *****
  • Posts: 3788
Re: Turret controlled by mouse
« Reply #5 on: November 02, 2009, 04:06:26 PM »
Because the Projectile object can be attached to a SkinMesh, you could avoid using RigidBodies for the turret+cannon. This would have two advantages

1. the iObjectOrientationSet() functions would work instantly

2. you wouldn't have to use Joints, that can make the system more complex than needed (probable cause of delayed response).

The drawback would be that setting up a turret and a cannon as distinct objects may not be as easy.

galaxie500

  • Newbie
  • *
  • Posts: 4
Re: Turret controlled by mouse
« Reply #6 on: November 03, 2009, 03:10:59 PM »
Hi everybody,

I've used RigidBodies because they can be connected with joints and I thought that this would be the easiest way to construct turret with multiple parts. One more thing is that you can detect collision (bullet hit turret) with RigidBodies which you can't do with SkinMeshes. Anyway, I'll take Fernando's proposition into consideration (which mean try to learn and understand scripting functions) and I'll try to do my turret in that way.

I have more ideas of how to do turret with joints and Rigies but I'm always stuck with scripting. Oh, I wish that Mike would continue his scripting tutoring.

And I would like to see some other guys solutions to that matter.

Anyway, thank you all for your help and nice comments. I'm going to dive into scripting and try to learn RADish as best as I can do.

Be back when I have something useful to show or discuss...
Logged