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 GDK / (C++ / DGK) Odd Model Behavior

Author
Message
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 16th Nov 2008 18:57
Just wondering if anybody else has ran into something similar

Here we go.

The stuff I am using EZRotate, DGK and MS VC++ 8.0

I am working on a Turret Model that is attached to a model

here is the "basic code" no Media needed.



This works great. When I basically transplanted this a larger application, added models something odd happens

The idea is to have multiple turrets on the same object.

when the Ship turns the turret also must turn to match the new angle of the ship and maintain it's angle.

The concept is Main Body, I glued on a object as a marker point (node) and then a new object that follows (positioned on) the Node (which is the turret). This allows me to have the Turret independent of most of the glued on limb object.

Now the issue I got is Turret Model flips around when then ship reach the 90' mark or the -90' mark. This does not happen in the basic demo, but in my game. If the turret is rotating by itself (the ship is not rotating) the model behaves like it should. But when the ship rotates and breaks the 90' or the -90' mark, the Turret Model flips what ever degree it was from the ships front angle. If it was 30' left of the center. It would be 30' right after the ship reached the 90' angle.

The behavior issue happens constantly at that point.

Here are the screen shots.

1) I have my turret rotate to the -90' Mark.

2) I rotate the ship upwards. This rotates the turret and the ship. When the ship hits the 90' mark it begins to count back down and my turret flips 90 (or if it was 45' it would flip 45') .

This is kinda driving me crazy. Has this happened to anybody else?

There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 16th Nov 2008 19:37
It's doing exactly what it's supposed to, technically. It goes from -180 to 180, and then flips and goes 180 to -180 on the other side. If you use dbRotateObjectLeft(), and watch it's angles on every axis, you should see this happen.

I've worked around this before, but I don't remember how.


My site, for various stuff that I make.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 16th Nov 2008 23:56
@ Timidon,

It looks like you have forgotten what was learned in this previous example.


A limb gets coupled to its parent once, and it will follow its parent continuously.

You do not have to keep track of the connection point and have the limb floating on that connection point, with complex calculations to keep things in track.

You have functions that will give you the real world co-ordinates of the turret itself to use for your targeting calculations.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 17th Nov 2008 02:11
I originally did something similar to this. Worked good with just 1 turret. I got my single turret working just fine.

The trouble started when I added the 2nd turret last week. When I tried to rotate the 2nd turret. The 2nd turret would swing out from the ship, based on where the limb was at. I figure because both turrets where linked to the same limb. So I started down a different path.

The approach above worked when it was just by itself. It gave me a nice free floating turret. Not working so well in practice.

Though I was using a different command. I will try the Turn Object one and see what happens.

I remove the node and glue the turret back in. Eventual I will get this figured out. Thanks. I will give this a try and see what happens. I will be so much more happier to advance beyond the turret issue (just so I can develop a few more weapon systems for my ship).

There are many answers but just one question" ~ Jerilith the Mad
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 17th Nov 2008 02:43 Edited at: 17th Nov 2008 03:20
Alright this is back to the original problem - based off the example you gave "sydbod". I am but still getting a similar result (though the models are not flipping crazy). This is the reason I started doing what I did. The thought was I could have multiple turrets on the same limb. If they where not part of the limb, but being tracked separately, they would be able to rotate freely on the fixed point. They do that but flip crazily when the moved. *Another fun picture* with slightly enlarged turret model.

1) Two turrets on same limb (limb 0)

2) Both turrets are turning, one slides out on a arc (I figure it's the limb). The center most turret has no problem - which is the first added. The 2nd turret slides out when it turns.

3) both turrets move with the ship., Is there any way of locking turret 2 into its place?

4) When looking at your example. I think the 2nd turret may be acting like the "Barrel" instead. The 2nd turret is created right after the first turret. But it's glued to the ship on limb 0.

Do I have to create another limb for another turret?

There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 17th Nov 2008 04:22
This is the procedure.

1) make your Ship (limb 0)

2) get the Co-ordinates on your ship for the mounting point of the first turret.

3) make your first turret, and mount it to that mounting point on the ship (limb 0)

4) get the Co-ordinates on the ship for the mounting point of the second turret. (it has its own mounting point)

5) make your second turret, and mount it to the second mounting point location on the ship (limb 0)

Note: each turret is mounted to the ship (limb 0) but on its own mounting point, and the origin point of each individual turret when it is created, will be the turrets rotation point.

Your picture looks like one gun is mounted to the second gun, and the second gun is mounted to the ship. Each gun has to be individually mounted to the ship at their own respective mounting points.

Let us know how things work out.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 17th Nov 2008 05:35 Edited at: 17th Nov 2008 05:39
I understand now and the it is clear, it like the sun came out and removed the headache. The turrets now correctly work.

Now that I can see the problem, I can tell you what I did wrong. Allot of the examples I have seen have adjust the limb with the "dbOffsetLimb ( nTurretID, 0, 0, 3.2, 0);" command. I assumed that was how to move the object inside the limb.

Using using the dbPostionObject instead, makes a big difference. I have spent a better part of 2 weeks pulling my hair out. I final got enough information to ask somebody else. Just for this . I give you the happy turret screen shot. Both turrets rotating, no strange twitching, not a turret acting as a barrel.

Now to put the target system back in. Now that the turret system is working correctly.

Thanks "sydbod". That did it. Unless anybody else has question. I think that's one more nail in this coffin.

There are many answers but just one question" ~ Jerilith the Mad

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-09-30 11:29:06
Your offset time is: 2024-09-30 11:29:06