Unable to change properties of moving timber planks in Catapult example when they are hit by a non-cannonball

At the moment, we’re playing with remixing the Catapult example (created by the CoSpaces team).

When the cannonball hits the platform, the timber planks become displaced or fall down (the way we would expect it to in the real world). However, if we replace the cannon ball with a different object (eg. the hedgehog), we can get it to fly through the air etc, but when it hits the timber planks, nothing happens to the timber.

I can’t find anywhere in the code, or the physics properties of the actual objects themselves, that is different. Can I get the timber to move when anything other than the cannonball hits it?

Could you share the link to your space, with remix enabled, so others can test this?

Many thanks,
Geoff@TechLeap

Thank you
:blush:

https://edu.cospaces.io/Universe/Space/TgkVybOGulM6jY9G

image002.png

It is odd. Weight seems to be applied based on size of object by default, so that’s why your hedgehog doesn’t have much impact.

My feeling is that the Catapult project is old code which was in Blockly or Javascript, and got destroyed in the conversion to CoBlocks, and needs to be rebuilt. There seems to be a lot of code that does nothing, like it was supposed to go somewhere, but then doesn’t get used. For example, changing the weight does nothing to the physics - you can see this in the code and in testing.

@Nikolay, can you confirm?

Geoff@TechLeap

The code is old, not optimised, but working.
I set the hedgehog’s weight to 200kg and was able to shoot him and destroy the tower.

The bigger problem is that the hedgehog’s model has complex collision box and that creates unpredictable trajectory, collision and catapult placement. If you want more control on this physics, you can create an invisible auxiliary object with physics, attach hedgehog to this object and didn’t add him to physics. When you throw this object, his predictable physics will be used for throwing and positioning, and hedgehog will be only visual effect for it.

Hope this helps

Thank you so much - I will try this and see how it goes. I really appreciate your time and assistance with helping to fix this problem.

Kind regards,

Outlook-1518392070.gif

Outlook-Email Foot.png

My point was more that the interactive UI for weight & velocity doesn’t work.

Yes, this part of code is broken. The variable ballWeight is not used. You can fix it by setting weight in the fire event.

Velocity is applied correctly

It would be great if you or one of the team could fix it, or take it out of the gallery so that it’s not showcasing broken code.

Geoff @ TechLeap

Sure, I’ve updated it

1 Like