scp-fs2open / scp-fs2open/fs2open.github.com

null vector being normalized

Open
#4,454 3 comments 0 reactions 0 assignees View on GitHub
bug physics
Dominant language
C++
Stars
487
Forks
184
Avg merge
3d 8h
Merged PRs (30d)
45

Description

Not sure how long this has been going on, I noticed this after doing a bunch of nprintf conversion to cut down on my log noise(probably going to submit that later but it's not suited for it yet), so it may have been in there for a wile

"Null vec3d in vec3d normalize.
Trace out of vecmat.cpp and find offending code."

and the trace

```
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!vm_vec_copy_normalize(vec3d * dest, const vec3d * src) Line 457 (d:\Code\fso2\src\code\math\vecmat.cpp:457)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!vm_vec_normalize(vec3d * v) Line 480 (d:\Code\fso2\src\code\math\vecmat.cpp:480)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!beam_ok_to_fire(beam * b) Line 4016 (d:\Code\fso2\src\code\weapon\beam.cpp:4016)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!beam_fire(beam_fire_info * fire_info) Line 546 (d:\Code\fso2\src\code\weapon\beam.cpp:546)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!turret_fire_weapon(int weapon_num, ship_subsys * turret, int parent_objnum, vec3d * turret_pos, vec3d * firing_vec, vec3d * predicted_pos, float flak_range_override) Line 1837 (d:\Code\fso2\src\code\ai\aiturret.cpp:1837)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!ai_turret_execute_behavior(ship * shipp, ship_subsys * ss) Line 2710 (d:\Code\fso2\src\code\ai\aiturret.cpp:2710)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!ai_process_subobjects(int objnum) Line 11718 (d:\Code\fso2\src\code\ai\aicode.cpp:11718)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!ai_frame(int objnum) Line 14694 (d:\Code\fso2\src\code\ai\aicode.cpp:14694)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!ai_process(object * obj, int ai_index, float frametime) Line 14828 (d:\Code\fso2\src\code\ai\aicode.cpp:14828)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!ship_evaluate_ai(object * obj, float frametime) Line 9343 (d:\Code\fso2\src\code\ship\ship.cpp:9343)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!ship_process_pre(object * obj, float frametime) Line 9368 (d:\Code\fso2\src\code\ship\ship.cpp:9368)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!obj_move_all_pre(object * objp, float frametime) Line 1146 (d:\Code\fso2\src\code\object\object.cpp:1146)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!obj_move_all(float frametime) Line 1508 (d:\Code\fso2\src\code\object\object.cpp:1508)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!game_simulation_frame() Line 3614 (d:\Code\fso2\src\freespace2\freespace.cpp:3614)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!game_frame(bool paused) Line 4019 (d:\Code\fso2\src\freespace2\freespace.cpp:4019)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!game_do_frame(bool set_frametime) Line 4395 (d:\Code\fso2\src\freespace2\freespace.cpp:4395)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!game_do_state(int state) Line 6175 (d:\Code\fso2\src\freespace2\freespace.cpp:6175)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!gameseq_process_events() Line 390 (d:\Code\fso2\src\code\gamesequence\gamesequence.cpp:390)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!game_main(int argc, char * * argv) Line 6648 (d:\Code\fso2\src\freespace2\freespace.cpp:6648)
fs2_open_22_1_0_x64_SSE2-DEBUG.exe!SDL_main(int argc, char * * argv) Line 7710 (d:\Code\fso2\src\freespace2\freespace.cpp:7710)
```

Seems to be related to beam aiming, all the inputs to aim_dir in beam_ok_to_fire are 0,0,0 on inspection in debug

Not well isolated, submitting before I forget

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.