Skip to main content
added 367 characters in body
Source Link
Zibelas
  • 5k
  • 2
  • 15
  • 26

The key difference is: do you want physics to interact with your object or not. And if you need it or not will depend on your game.

Updating the position directly will place the object there, regardless if there is something or not. Since you mentioned a card, it is easier to NOT use a rigidbody. You would want physics interaction in case when you push your card across the table, it should push other cards away. But in a card game you have fixed positions where cards should/ can go and it would look weird if other cards get affected in there position just because you touched them while moving your own card.

Your second piece of code would also workd with the position directly and still using lerp by just giving the start position (probably from your hand) to the destination position (table, trash, etc).

If you are creating a game similar to table top simulator, your card would probably have a rigidbody. But in 97% of all other card games, it wont be needed and you can move your card by position directly.

I have made a few mini card games that have neither collider nor a rigidbody. They mainly use the canvas and are just images. I use a placeholder image at the drop location to indicate where the card/ tile will go when placed down and snap it afterwards to that position.

enter image description here

The key difference is: do you want physics to interact with your object or not. And if you need it or not will depend on your game.

Updating the position directly will place the object there, regardless if there is something or not. Since you mentioned a card, it is easier to NOT use a rigidbody. You would want physics interaction in case when you push your card across the table, it should push other cards away. But in a card game you have fixed positions where cards should/ can go and it would look weird if other cards get affected in there position just because you touched them while moving your own card.

Your second piece of code would also workd with the position directly and still using lerp by just giving the start position (probably from your hand) to the destination position (table, trash, etc).

If you are creating a game similar to table top simulator, your card would probably have a rigidbody. But in 97% of all other card games, it wont be needed and you can move your card by position directly.

The key difference is: do you want physics to interact with your object or not. And if you need it or not will depend on your game.

Updating the position directly will place the object there, regardless if there is something or not. Since you mentioned a card, it is easier to NOT use a rigidbody. You would want physics interaction in case when you push your card across the table, it should push other cards away. But in a card game you have fixed positions where cards should/ can go and it would look weird if other cards get affected in there position just because you touched them while moving your own card.

Your second piece of code would also workd with the position directly and still using lerp by just giving the start position (probably from your hand) to the destination position (table, trash, etc).

If you are creating a game similar to table top simulator, your card would probably have a rigidbody. But in 97% of all other card games, it wont be needed and you can move your card by position directly.

I have made a few mini card games that have neither collider nor a rigidbody. They mainly use the canvas and are just images. I use a placeholder image at the drop location to indicate where the card/ tile will go when placed down and snap it afterwards to that position.

enter image description here

Source Link
Zibelas
  • 5k
  • 2
  • 15
  • 26

The key difference is: do you want physics to interact with your object or not. And if you need it or not will depend on your game.

Updating the position directly will place the object there, regardless if there is something or not. Since you mentioned a card, it is easier to NOT use a rigidbody. You would want physics interaction in case when you push your card across the table, it should push other cards away. But in a card game you have fixed positions where cards should/ can go and it would look weird if other cards get affected in there position just because you touched them while moving your own card.

Your second piece of code would also workd with the position directly and still using lerp by just giving the start position (probably from your hand) to the destination position (table, trash, etc).

If you are creating a game similar to table top simulator, your card would probably have a rigidbody. But in 97% of all other card games, it wont be needed and you can move your card by position directly.