0 votes

Hello ,
I have a node StaticBody2D >> Sprite>>CollisionShape2D
now i HAVE A script which randomly changes the texture associated with the sprite.
NOw say the sprite has texture 'a' , n when it changes its texture from 'a' to 'b'
the collision shape should be disable and the objects (players) standing on the sprite should fall down

Any Help WIll be Highly Appreciated !

in Engine by (34 points)

1 Answer

–2 votes


I’m sorry my English and the fact that I’m a complete noob in the programming world and in the Godot Engine, but . . .

Some days ago I try some thing similar.

In my case I use this:

get_node ( "CollisionShape2D" ).set_trigger ( true )

true – the collision shape is deactivated

false – the collision shape is activated

by (11 points)

It's not working..

? it's worked for me

thank you everyone :) !

oops , sorry, im using another code, it was like this :

get_node("CollisionShape2D").disabled = true

and if we want to return it back ,use:
get_node("CollisionShape2D").disabled = false

---this is in Godot version 3---

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.