Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After all the missiles on the aircraft were launched, they were not reconfigured in subsequent environmental resets #79

Open
cjmdd opened this issue Nov 14, 2023 · 1 comment

Comments

@cjmdd
Copy link

cjmdd commented Nov 14, 2023

After all the missiles on the aircraft were launched, they were not reconfigured in subsequent environmental resets. We tried to add the following codes to the fit_missile function in MissileDevice Class and the reset function in Aircraft Class but it was still unsuccessful. Print and display all as None.

def fit_missile(self, missile, slot_id):
    nd = missile.get_parent_node()
    nd.GetTransform().SetParent(self.slots_nodes[slot_id])
    # print("Fit Missile"+str(slot_id)+" "+str(pos.x)+" "+str(pos.y)+" "+str(pos.z))
    missile.reset(hg.Vec3(0, 0, 0), hg.Vec3(0, 0, 0))
    self.missiles[slot_id] = missile
    self.missiles_total.append(missile) %%%%%%we add global missiles to reconfigure them when all missiles are fired.

def reset():
%%%%%%we add%%%%%%%%%%%%
md=self.get_device("MissilesDevice")
n_m=md.num_slots
for i in range(n_m):
mmd=md.missiles_total[i]
nmd=md.missiles[i]
if nmd is None:
md.missiles[i] = mmd# reset in there

        if position is not None:
            nmd.reset(position, rotation)
        else:
            nmd.reset(hg.Vec3(0, 0, 0), hg.Vec3(0, 0, 0))
@ErkMkd
Copy link
Contributor

ErkMkd commented Nov 15, 2023

Use the Machine.rearm() function to reset the missiles.
Each missile is assigned to its aircraft, even when it's fired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants