Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Trivial Psychic on November 28, 2016, 06:22:26 pm
-
I've got a situation with one of my loop missions in FS1: Enhanced (http://www.hard-light.net/forums/index.php?topic=92783.0), where Shivan freighters fully loaded with cargo are to release the cargo quickly and depart. I was hoping to use the jettison-cargo-delay sexp, but it simply releases the cargo and it gets scraped on the hull. Is there any easy way to either modify the existing sexp or generating a new one with user-definable ejection speed so they can clear the ship?
-
Not to cut of the feature request, but can't you achieve what you are looking for with high blast, no damage explosion-effects? (You would have to set the freighters to immobile for second or two, so they don't get tossed around)
-
I've got a situation with one of my loop missions in FS1: Enhanced (http://www.hard-light.net/forums/index.php?topic=92783.0), where Shivan freighters fully loaded with cargo are to release the cargo quickly and depart. I was hoping to use the jettison-cargo-delay sexp, but it simply releases the cargo and it gets scraped on the hull. Is there any easy way to either modify the existing sexp or generating a new one with user-definable ejection speed so they can clear the ship?
Well, it would have to be ejection vector and speed, but yes, this is certainly doable.
-
I felt that the vector should be down the dockpoint normals. The speed, I felt, would need to be user-definable, because some ships would only need a slight kick, while others like the Chronos would need a more significant ejection speed to clear the hull.
-
How about set-object-speed and collision groups?
-
Here is the code in question:
// physics stuff
vm_vec_sub(&pos, &cargo_objp->pos, &objp->pos);
impulse = pos;
vm_vec_scale(&impulse, 100.0f);
vm_vec_normalize(&pos);
// whack the ship
physics_apply_whack(&impulse, &pos, &cargo_objp->phys_info, &cargo_objp->orient, cargo_objp->phys_info.mass);
That vector is wrong; what it's doing is comparing the centers of the two ships. It should use the dockpoint normal as Trivial Psychic says. This explains why some cargo containers get hung up on their ships.
Furthermore, since not all dockpoints are equally distant from the centers of their host ships, the farther dockpoints will be ejected with greater force than the closer dockpoints.
The best solution is probably to write a new jettison-cargo sexp and deprecate the old one. The new sexp should use proper physics and provide an optional argument for ejection force. I should be able to do that tomorrow.
-
Awesome. Thanks. Perhaps instead it could be called eject-cargo.
-
PR posted:
https://github.com/scp-fs2open/fs2open.github.com/pull/1085
-
Awesome! Thanks! :yes:
-
Seems to be working fine. Thanks again! :yes:
-
Glad to hear it. :)