Skip to main content
Rollback to Revision 6
Source Link
House
  • 73.5k
  • 17
  • 188
  • 276

GameObject Detection How can I detect if a gameObject has collided with two other specific objects at the same time?

How can I detect if a gameObject has collided with two other specific objects AT THE SAME TIME?

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

GameObject Detection

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

How can I detect if a gameObject has collided with two other specific objects at the same time?

How can I detect if a gameObject has collided with two other specific objects AT THE SAME TIME?

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

deleted 99 characters in body; edited tags; edited title
Source Link
That's me.
  • 359
  • 3
  • 10
  • 24

How can I detect if a gameObject has collided with two other specific objects at the same time? GameObject Detection

How can I detect if a gameObject has collided with two other specific objects AT THE SAME TIME?

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

How can I detect if a gameObject has collided with two other specific objects at the same time?

How can I detect if a gameObject has collided with two other specific objects AT THE SAME TIME?

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

GameObject Detection

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

Post Reopened by Trevor Powell, CommunityBot
Rollback to Revision 4
Source Link
Trevor Powell
  • 21.5k
  • 1
  • 63
  • 96

Displaying GameObject's current altitude How can I detect if a gameObject has collided with two other specific objects at the same time?

How can I displaydetect if a GameObject's current altitude like in the game "Doodle Jump"gameObject has collided with two other specific objects AT THE SAME TIME?

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

Displaying GameObject's current altitude?

How can I display a GameObject's current altitude like in the game "Doodle Jump"?

How can I detect if a gameObject has collided with two other specific objects at the same time?

How can I detect if a gameObject has collided with two other specific objects AT THE SAME TIME?

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

Post Closed as "Duplicate" by Trevor Powell, CommunityBot
deleted 268 characters in body; edited title
Source Link
That's me.
  • 359
  • 3
  • 10
  • 24
Loading
Tweeted twitter.com/StackGameDev/status/657016786311860225
Rollback to Revision 2
Source Link
Elva
  • 3.2k
  • 1
  • 22
  • 31
Loading
added 1294 characters in body; edited tags; edited title
Source Link
That's me.
  • 359
  • 3
  • 10
  • 24
Loading
added 59 characters in body
Source Link
That's me.
  • 359
  • 3
  • 10
  • 24
Loading
Source Link
That's me.
  • 359
  • 3
  • 10
  • 24
Loading