Tagged Questions
0
votes
0answers
26 views
Why is this code not being responsive on mobile devices with unity? [on hold]
So I am building a stupid simple game where all you need to do is click some balls on the screen and if I were to do this in java it would be no problem. How it works is when you click the screen it ...
0
votes
1answer
32 views
Trajectory Projectile with Collision Detection
Right now I am trying to create projectile for cannon in which I want to detect collision also.
At present I have simple working projectile after using two references
Unity – How to display ...
2
votes
1answer
212 views
How to simulate wind in 2D
for a 2D scenario, I wanted to have a fan blow at an object and make it move with the "wind", how can I simulate the wind under these circumstances?
0
votes
1answer
79 views
How should I detect collisions with objects on a “timeline”?
I'd like to replicate this game's mechanic of the player smashing walls with a precise timing to a background rhythm.
How should I check when each wall should be broken? Does the player animation use ...
1
vote
1answer
87 views
Trigger for Melee-attack not working
I'm currently trying to add a melee-slash attack to my Sidescroller.
For that I decided to to have an invisible box-colliders infront of my character. My idea is to activate it when the attack-key is ...
2
votes
1answer
42 views
Is there a way to view all colliders in a unity project at runtime (after the game have been deployed)?
I'm have created a small Unity project but physics has weird behavior (bug). Unfortunately it only happens on some specific hardware (after build), not on development machine.
I don't know what is ...
3
votes
2answers
399 views
Detect collision from a particular side
I'm making a platform sidescrolling game. All I want to do is to detect if my character is on the floor:
function OnCollisionStay (col : Collision){
if(col.gameObject.tag == "Floor"){
...
1
vote
2answers
120 views
Object goes straight through game object without colliding
The "shot" is supposed to collide with the left bumper and then be destroyed, but the shot goes right through it. Both objects have a box collider.
The following is the code I am using:
#pragma ...
1
vote
2answers
87 views
Unity - Across the wall
I have a problem here.
I animated my main character and is working. It walks run and jump however it goes across walls and ground.
As in every single video I watch in unity tutorials I put a ...
1
vote
1answer
64 views
Different OnMouseDown functions based on where an object is clicked
So my problem is I'd like to have one GameObject with multiple "OnMouseDown" functions. I have a target (classic looking bullseye) and I'd like to award a player say 10 points if they click on it, but ...
1
vote
1answer
74 views
Is this Possible to force gameobjects (coliders etc) to get stretched based on the aspect ratio of the screen?
Well with unity3D, I am in big trouble whenever I use sprites. As for textures I compensate for a evener look by Stretching it (Screen.width & Screen.height- that's fine for low end 2D games). Now ...
2
votes
2answers
72 views
Can I make a character solid but not lose non-physics behaviour?
My character can walk around in the world, but walks through other objects, for example a cylinder (stand-in for a cannon). To fix this I added a capsule collider to each of the character and ...
0
votes
1answer
217 views
How to find objects in front of my player
I am trying to find an object that is in front of my player sprite using the following code
RaycastHit2D hit = Physics2D.Raycast(transform.position,Vector2.right,EnemyLayer);
//EnemyLayer is the ...
0
votes
0answers
97 views
Moving object next to another object
Is there a common way to get to game objects with colliders to 'touch' each other without trying to reach the same position?
I dont want to move object A to the position of object B cause they will ...
0
votes
1answer
172 views
How do I add a Rigid body and a box collider component to a Texture2D?
I am making a snake game. I'm basing it on a basic tutorial game, which does no collision detection, wall checking or different levels.
All snake head, piece, food, even the background is made of ...
0
votes
2answers
268 views
Why is mesh baking causing huge performance spikes?
A couple of seconds into the gameplay on my Android device, I see huge performance spikes caused by "Mesh.Bake Scaled Mesh PhysX CollisionData"
In my game, a whole level is a parent object containing ...
2
votes
0answers
79 views
How to impale and stack targets correctly according to the collider and its coordinate?
I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how:
At the start, the falling object (in red) will fall in a ...
0
votes
1answer
654 views
Platformer raycast collision detection
I'm using Unity to create a 2D platformer. For collision detection, I'm using raycasting to detect any possible collisions with specific collision layers, and adjusting the desired delta x & y ...
8
votes
2answers
673 views
How can I prevent rigid bodies from moving through each other using Unity's built-in physics?
I'm trying to create a game where objects can be dragged, but I'm having trouble with the physics. With rigid bodies that have similar masses, they sometimes push through each other when dragged and ...
1
vote
1answer
197 views
Strange collision behaviour in 2D game even though the collision is very basic [closed]
I have a player ship (cube) and some enemy laser projectiles. When the player ship has position X values greater than 1, collision with the enemy projectiles occur but when it has lower X values, the ...
2
votes
1answer
129 views
At same positioned game objects collision detection
In my game, I am creating two game objects at same position using Instantiate statement. Each generated object has box collider attached.
So I want to detect collision between them so I write ...
0
votes
0answers
444 views
Slope polygon collider 2D causing box collider 2D to 'bump' while sliding on it
I'm doing procedural terrain generation. So far I've created the mesh, and attached a 2D polygon collider to it. The terrain is made up of hills going up and down.
After doing so, I put a 2D rigid ...
0
votes
0answers
297 views
NavMesh agents pushing other NavMesh Agents in Unity Pro
Using the NavMesh system in Unity, I created pathing system for my player character as well as the enemy AI.
When a group of enemy NavMesh Agents surround my player character, they can be pushed out ...
2
votes
3answers
191 views
Strategy for detecting hits from a “cylinder ray”?
I was planning on using ray casting for collision detection in my game. However, when I use an attack similar to this:
(which would project something like a cylinder), how would I go about ...
2
votes
1answer
266 views
Project collision shapes to plane for 2.5D collision detection
I am working on a top down 2.5D game. In the game anything that overlaps on the screen should be 'colliding' with each other regardless of whether they are on the same plane in the 3D world. This is ...
2
votes
1answer
206 views
3D movement on an authoritiative server?
I'm developing an MMORPG, using Unity for the client and "standard" C# 4.0 for the authoritative server. The server should check each player's movement and ensure that it does not collide with props ...
0
votes
1answer
352 views
Detecting if “Wall” To The Left or Right Of Player Unity3D
I am working on a 3D Platformer in Unity3D and I need to prevent the player from going through walls. The movement for my player works like this:
(A bird-eye-view representation)The areas the ...
0
votes
1answer
131 views
Gravity/collision problems: models jumping
I'm pretty new to Unity3D game engine and game development, so don't judge me strictly. I import a model of the rail track, add rigid body component (with mass 1 and use gravity flag) and box collider ...
0
votes
1answer
3k views
Unity: OnCollisionEnter not called
I created a sphere object, added a rigidbody component (no kinematics) and attached a script to it like this:
function Update () {
}
function OnCollisionEnter(collision : Collision) {
...
1
vote
0answers
620 views
Unity3D: collider performances on mobile iOS devices
I'm experimenting with Unity3D and colliders. Unfortunately I still don't have Unity Pro version and I can't use the profiler.
Consider the following situation:
mobile devices (ios, iphone 3GS).
an ...
7
votes
1answer
2k views
Why doesn't Unity's OnCollisionEnter give me surface normals, and what's the most reliable way to get them?
Unity's on collision event gives you a Collision object that gives you some information about the collision that happened (including a list of ContactPoints with hit normals).
But what you don't get ...
1
vote
1answer
2k views
Unity Particle System collision detection problem
I'm using Unity 3.5.5f3 wich has the Shuriken particle system.
I've made a blood particle system based on Unity's demos. (Exploding paint [Blood])
The blood is flowing and when it collides with a ...
4
votes
1answer
7k views
How to detect collision in Unity3D without rigid bodies?
The target platform of my game is mobile devices therefore I try to develop it performance oriented. It will be a strategy game so I don't really need physics in it, consequently I did not add ...
6
votes
1answer
691 views
Creating custom collision map for 2D
I have a 2D level that I have built in my map editor, and I was wondering the best way to create a collision map for it.
I have a collision map layer in my map editor, which saves each node (for ...
2
votes
2answers
651 views
Do I have too many colliders on my screen?
I'm running into a situation where my frame rate drops from 70 FPS (on my desktop computer) down to 5 FPS (on my iphone) and I'm trying to understand why. At the moment, I'm only drawing simple ...
3
votes
3answers
5k views
How do I tell if an object is currently colliding with another object?
I know this sounds simple, but I can't figure out how to tell if a GameObject is currently colliding with another object in Unity. I've looked online, but can't find any tutorials or answers that ...
8
votes
4answers
5k views
Ignore collisions with some objects in certain contexts
I'm making a racing game with cars in Unity. The car has a boost/nitro powerup. While boosting, I wouldn't want to be deviated when colliding with zombies, but I do want to be deviated when colliding ...
5
votes
1answer
1k views
Finding if a point is inside of a mesh (Point-in-polyhedron)
How can I find if a point (Vector3) is inside of a mesh? Would this work for both concave and convex objects? I read somewhere that if you raycast in both directions of every axis (X, -X, Y, -Y, Z, ...
1
vote
1answer
3k views
Collision intepenetration and objects getting stuck (Unity)
I am having what is probably a newbie problem with Unity, but for the life of me, I can't find a decent solution to it. In short: my rigid bodies collide, but sometimes, they interpenetrate and stay ...
3
votes
1answer
899 views
Effects of collisons: broken glass, damaged cars, how are they created?
My question is related in particular to achieving the effects of collision in game engine, how is this done?
I have searched a bit, read from the internet and went through a few tutorials, and saw ...
2
votes
1answer
959 views
Unity3D animation and world collisions?
I'm using death animation for my enemies but the problem is that when enemy dies he crosses the walls/world. I want enemy/animation to be pushed back into world when he dies (animation is playing). ...
0
votes
3answers
5k views
2D games on Unity and collision detection performance
I'm developing a 2D game for the iOS platform. I have seen a lot of packages on asset store that makes 2D asset creation for unity easier.
I have narrowed my selection to just 2, 2d toolkit and ex2d. ...
0
votes
1answer
821 views
How to find which side of a collider has been hit from hit.normal?
In Unity3d, i can get the normal of the surface with which the collider collides using hit.normal, but is there a way to find which side has been hit what is provided bu Unity3d?
One solution is to ...
5
votes
1answer
3k views
How can I set up a Pong-style game using the physics system in Unity?
I've just been using Unity and chose to learn it by making a Pong game which sounded simple enough as a "hello world" type of game. My goal was to try and encompass enough of the built in engine ...
2
votes
3answers
3k views
Unity, changing gravity game & stopping character when he hit a wall
i am currently working on a 2d puzzle game in the unity engine. One of the aspect of this game is the possibility to rotate the level of 90°. It also rotate the gravity.
The main character is not ...
5
votes
3answers
1k views
Make my NPC “see” gameobjects around him in Unity
I have a walking NPC that will "see" the wall in front or behind him (2d gameplay) and that will react accordingly.
I was thinking to attach him to an invisible collider that would react to objects ...
1
vote
4answers
2k views
Have a simple enemy detecting he touch a wall to make him stop/turn around
I am doing a very simple scene with a cube sliding on the "ground". Once the cube reach a wall, he is blocked.
I want to detect the wall to make the cube go in the other direction. I used ...