|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
petrickprajapati |
I’m create game in which i have create Area2D node for each stone. what i want is when i drag stone i don’t to overlap with other stones.
My Node Tree Look like: BaseStone.tscn
--Area2D
--|----Sprite
--|----CollisionShape2D
My all stone are inherit from BaseStone.tscn
|
|
|
|
Reply From: |
Dlean Jeans |
Sounds like you need collision. Use RigidBody2D
or KinematicBody2D
.
I used KinematicBody2D body but still its overlapping. do i have make any changes ?
--KinematicBody2D
--|----Sprite
--|----CollisionShape2D
i have two object in one scene, but still this two object overlapping.
Any idea??
petrickprajapati | 2019-05-12 06:39
With KinematicBody2D
you have to call move_and_slide
or move_and_collide
for the collision to work. Or you can just use RigidBody2D
.
Dlean Jeans | 2019-05-12 10:28
Thanks , i’m not calling move_and_slide
thats why node get overlapped.
petrickprajapati | 2019-05-12 13:29
|
|
|
|
Reply From: |
DavidPeterWorks |
What about the use of collision layers and masks?
You can set a layer for stones and remove the mask for stone layer.
It will work if you do not want to have any collision among stones.