May 13, 2024, 17:18:31

Author Topic: Issues with turret orientation and hardpoints  (Read 10137 times)

Offline jstubbles

  • Petty Officer
  • **
  • Posts: 169
  • Karma: 2
    • View Profile
    • http://www.ivassago.com
Issues with turret orientation and hardpoints
« on: March 16, 2010, 17:36:41 »
In the documentation, there's no defined orientation for models. Each engine is different so one has to assume that given examples are correct. With Nexus, the example meshes show that models should be facing the -Z axis. That is the "front" of a model. So I've built all of my models with this in mind. I am however, experiencing unpredictable and incorrect behavior with hardpoint placement for my turrets. The model I'm working on (battlestar Pegasus) has some irregular turret placements so for the sake of simplicity I'll just use a typical battleship "row" of guns in my example.

The documentation states that the first point of a hardpoint is the right angle of the triangle, the second point is it's X-axis and the third point being the turret's resting position. Now, lets start with a little geometry refresh. This, is a right angle:



So according to the documentation, the first vertex of a hardpoint would be the red box, or right angle, then the second would be to it's left, dictating it's X-axis, then lastly the third vertex is where the resting position is. So if I were to build the hardpoint in this fashion:



One would think I'd have a correctly oriented cannon facing forward. This is not the case, however. This results in the cannons facing backwards from the bow of the ship. How is this? The first vertex is the center and it should point to the last vertex??? I'm not sure why it's doing this, or if the documentation is wrong, but it seems that hardpoints are pointing from #3 to #1, not the other way around. If I build the triangle 180º, like this:



THEN I get a gun where the barrels face the bow of the ship. What gives?


This brings me to my next problem and certainly the most infuriating of the two. I want a battleship firefight. Line abreast, firing your rows of cannon. I'm having the most difficult time trying to create this, though.

Ships are allowed to have 8 weapon slots for basic rotating turrets. They are designed to cover a 180º half-sphere of whatever Y-axis they are orientated towards, meaning for each slot, you should have a triangle on top and bottom, giving you 360º coverage around the ship. I want to have those 8 turrets available to fire down the line, regardless of which side the enemy is on, so I have to have all 8 turrets (16 hardpoints) on EACH side of the ship, 8 on top, 8 mirrored to the bottom, giving me my 360º bubble.

The problem I'm running into in doing this, is that the game engine fires from the OPPOSITE side of the ship from where the target is located. So if an enemy is to my right, the left side of the ship fires through through my hull, as opposed to right side of the ship firing like it should. So this is what I get:



These guns are all oriented face-forward, so I'm absolutely clueless as to why it chooses guns on the opposite side of my ship to fire at the enemy. If anyone has an idea, I'll give you a cookie. :D

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #1 on: March 16, 2010, 22:19:45 »
My knowledge on this matter is extremely limited, and I'll throw out the only thing I really noticed from reading your example: When you rotated the points to get the turret facing forward, did you not effectively reverse the direction of point 2 from left to right? And if so, could flipping that one point possibly be the reason for the turrets targeting in the wrong direction?

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #2 on: March 17, 2010, 00:03:24 »
Hi,

When it comes to placing normal hardpoints, it 's my understanding that...

1)  The first point of the triangle (the right angle section) is where the actual weapon will sit on the mesh.
2)  The second point of the triangle points to the weapons righthand side.
3)  Finally, the third point dictates what direction the weapon will point in while 'resting'.

As for your other little problem, this could be a little more awkward. If I've read your description right, then all the turrets are located on both the top and bottom of the ship while having a horizontal orientation?

Well, what we have to remember is that when it comes to weapons arcs, Nexus is not that intelligent. In it's world, a turret can elevate up to ninety degrees and rotate through the full three-sixty. Therefore, any enemy within this hemisphere is fair game, regardless of whether or not the shot is realistically possibly (i.e. through the hull).

The only real solution I have at the mo, would be to angle the turrets 'outwards' so that the hull doesn't 'block' the fire arc.  This way, a shot from the 'off-side' would only occur when the target gets high enough (or low enough) to clear the hull and create a clear shot. The only thing with this would be how the model looked afterwards.

Hope that helps.
Better to look the fool by asking, then prove them right with ignorance.

Offline jstubbles

  • Petty Officer
  • **
  • Posts: 169
  • Karma: 2
    • View Profile
    • http://www.ivassago.com
(No subject)
« Reply #3 on: March 17, 2010, 07:44:28 »
In my example above, the first vertex (right angle) was followed by a second to it's right, then a third below. Bear in mind the "up" would be the bow of the ship. When I loaded that into the game, the gun showed up backwards on the ship, facing stern. So it's like the last point was the origin, and the first point was the resting position of the barrels. I weapon model is facing -Z just like all of the example meshes, but just to test I rotated it 180º and it still did the same thing, so that's not it. Guess the documentation is wrong or something?

As for the side fire issue, yeah I see what you mean now. At the time I posted this I had been spending several hours trying to get it working as was quite frustrated. After stepping back and taking a break, it's much clearer to see the issues now. Thanks :)

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #4 on: March 17, 2010, 16:17:00 »
Generally, turret placement for all rotating turrets goes like this (looked at from the top):


[list=1]
[/li][li]is the actual position of your turret
[/li][li]points to the right side of your turret
[/li][li]points to the resting position of the turret's barrel, which is usually the front of it
[/li][/list]

The turret will rotate around an upward facing angle at 1 (or more accurately: around #center# on the turret itself, which often happens to be in the same spot, more or less) while also raising and lowering the barrel to aim at anything in a half-sphere "above" the turret.

If you place one turret at the upper side and another at the bottom of the ship while both assigning to the same slot, both turrets will cover their respective half-spheres (actually, even more than that, if necessary). If you happen to only place a single turret on your ship, it will still be able to fire at anything, anywhere by simply firing through your ship's hull, so it's a good idea of having at least two turrets per slot on opposite sides of the ship to avoid that scenario.

Things get a little awkward when mixing that with non-rotating turrets such as Nexus' flak lasers. They will be rotated 90 degrees around the X axis, so their upper side faces to 3 while the turret's base is located at 1. This makes it necessary to position 3 in such a way, that it points in the shooting direction of the turret instead (generally upward, away from the ship's model). If placed correctly, it should point to the center of the imagined half-sphere.

Non-rotating turrets will also cover all 360 degrees around them, if necessary (when being the only turret of a slot, for example). You can restrict that by using the CannonMaxFireAng in the DEVICETYPE definition in tacticstypes.ini ... by setting it to 90, the turret will only cover a half-sphere, for example, since it can't deviate any more than 90 degrees from the center of its default firing cone.

Because of the differences between rotating and non-rotating turrets I'd advise against mixing both types in the same kind of slots, since using a non-rotating turret in a slot meant for rotating turrets won't look or play right. You can make non-rotated turrets useable in slots for rotating turrets by simply making a 3-layered rotating turret and only filling up the fixed, non-animated layer with actual geometry. The other two layers meant for the rotating base and raised/lowered barrel should be filled up with some small, next-to-invisible geometry to trick the game into thinking it is a rotating turret. A single, really small triangle should be sufficient for that.

PS: Weapons without a turret mesh will act as non-rotating turrets, so keep that in mind.

Offline jstubbles

  • Petty Officer
  • **
  • Posts: 169
  • Karma: 2
    • View Profile
    • http://www.ivassago.com
(No subject)
« Reply #5 on: March 17, 2010, 20:19:32 »
Great explanation Arparso, thanks!

Does this mean that the examples given in the mod tools are incorrect then? They all have their fronts facing towards -Z in Lightwave, so I built my models according to that. When I create hardpoints in the way you mentioned, my barrels face backwards on the ship, not forwards.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #6 on: March 17, 2010, 21:59:15 »
Quote
Does this mean that the examples given in the mod tools are incorrect then? They all have their fronts facing towards -Z in Lightwave
They do? They seem to be facing towards +Z here (upwards in the "Top" viewport).

Offline jstubbles

  • Petty Officer
  • **
  • Posts: 169
  • Karma: 2
    • View Profile
    • http://www.ivassago.com
(No subject)
« Reply #7 on: March 18, 2010, 01:46:31 »
Hah! You're right. In Lightwave, +Z is "up" in the top viewport. I've been using Modo, which for some ungodly reason has -Z as "up" in the top view (doesn't make sense, seeing as how Modo was created by ex-Newtek employees. Geez....

Thanks! :)