The weapon_position_foo-keys are still broken in 1.72. And I don't actually recall that somebody was working to fix them.
Bug no 013273 on BerliOs.
weapon_position_foo still broken in 1.72
Moderators: winston, another_commander, Getafix
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
This is easy to fix.
Currently I can't see that weapon offset is used at all
Put simply
position.x += offset.x;
position.y += offset.y;
position.z += offset.z;
// just three lines in front of
orientation = [ship normalOrientation];
Vector v_up = vector_up_from_quaternion(orientation);
Vector v_forward = vector_forward_from_quaternion(orientation);
Vector v_right = vector_right_from_quaternion(orientation);
velocity = vector_multiply_scalar(v_forward, [ship flightSpeed]);
in function initLaserFromShip and laser will fire with x,y,z offset from
original ship position while retaining ship orientation, effectively making
laser offset that can move up-down left-right forward-backward
from ship position.
Greets, Branimir.
Currently I can't see that weapon offset is used at all
Put simply
position.x += offset.x;
position.y += offset.y;
position.z += offset.z;
// just three lines in front of
orientation = [ship normalOrientation];
Vector v_up = vector_up_from_quaternion(orientation);
Vector v_forward = vector_forward_from_quaternion(orientation);
Vector v_right = vector_right_from_quaternion(orientation);
velocity = vector_multiply_scalar(v_forward, [ship flightSpeed]);
in function initLaserFromShip and laser will fire with x,y,z offset from
original ship position while retaining ship orientation, effectively making
laser offset that can move up-down left-right forward-backward
from ship position.
Greets, Branimir.
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
And that's precisely what is wrong. You are correct on this one.bmaxa wrote:This is easy to fix.
Currently I can't see that weapon offset is used at all
Well, you will find that doing that requires to set all offsets in shipdata.plist to 0, if you want the laser to originate from the center front of the ship. I think we should find a somewhat more elegant way to do it, in order to not have to change all the shipdatas of all OXP ships ever released that contain weapons offsets. By just applying your fix, the laser moves indeed, but you will see that laser fire originates well outside the ship. You can check that by switching to external view.Put simply
position.x += offset.x;
position.y += offset.y;
position.z += offset.z;
// just three lines in front of
orientation = [ship normalOrientation];
<snipped the rest>
Of course, feel free to bring to the table ideas as they come, you are more than welcome. It's just that this particular fix has been discussed already and I don't really think it represents the best solution.
Sorry that was quick ,didn;t work as you say as we can;t simply
add to position (also relatively changes laser positon while flying), but this solution seems to work:
Vector vo1 = vector_multiply_scalar(v_forward, offset.z);
Vector vo2 = vector_multiply_scalar(v_right, offset.x);
Vector vo3 = vector_multiply_scalar(v_up, offset.y);
position = vector_add(position,vo1);
position = vector_add(position,vo2);
position = vector_add(position,vo3);
// position = vector_add(position, viewOffset); not needed anymore
rotMatrix = OOMatrixForQuaternionRotation(orientation);
Tested with Imperial Currier and positions seems right (all 4), especially
nose as laser points exactly from there as author typed offsets.
If OXP-s calculate offset from 0,0,0 this should work,
or I am missing something?
Problem will be if all three offsets are 0 by default than we can revert
to offset calculated based on bounding rectangle?
Greets, Branimir.
add to position (also relatively changes laser positon while flying), but this solution seems to work:
Vector vo1 = vector_multiply_scalar(v_forward, offset.z);
Vector vo2 = vector_multiply_scalar(v_right, offset.x);
Vector vo3 = vector_multiply_scalar(v_up, offset.y);
position = vector_add(position,vo1);
position = vector_add(position,vo2);
position = vector_add(position,vo3);
// position = vector_add(position, viewOffset); not needed anymore
rotMatrix = OOMatrixForQuaternionRotation(orientation);
Tested with Imperial Currier and positions seems right (all 4), especially
nose as laser points exactly from there as author typed offsets.
If OXP-s calculate offset from 0,0,0 this should work,
or I am missing something?
Problem will be if all three offsets are 0 by default than we can revert
to offset calculated based on bounding rectangle?
Greets, Branimir.