Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

2

YES! THANK YOU @trollingchar. I added the code to a script and attached the script to the button. that is exactly the functionality i was looking for. check out the link to the code: https://forum.unity.com/threads/none-rectangle-shaped-button.263684/#post-2146709 using UnityEngine; using UnityEngine.UI; [RequireComponent(typeof(RectTransform))] [...


3

There is one easy way that only works for round Shapes. In your Button callback you could test the distance of the mouse from the center of the button against the radius of the button and only trigger the click or hoover effect when it is within the buttons radius. But since you are new, maybe focus on making some gameplay rather than the button design. ...


0

Solved! I have one set of raycast2d (Raycast2D hit) for platforming collision and another set of raycast2d (Raycast2D Touched) for objects you interact with, but don't collide with like platforms. Thanks for your help! As always, I greatly appreciate it.


2

You can give the parent class a public method that takes two arguments, a Collider and some form of identification for which child was hit (e.g. a Transform or Vector3 or int id, depending on what layout the children are in). Then, in each child object, give them a script like using UnityEngine; public class ChildCollider : MonoBehaviour { void ...


1

You have just described my understanding of a game engine. A program that lets you build a game, and offers lots and lots of solutions to common problems in game development. In every game engine I know, there are options to disable, or just to ignore, the built-in physics system. I recommend Unity, but you should research pros and cons of different systems. ...


1

No game development police will come to arrest you if you try to store a non-manifold mesh in a spatial partition data structure for collision detection purposes. No law of physics will cause your computer to implode if you do this. So no, it's not a requirement to have a manifold mesh, nor is it impossible to use non-manifold geometry in a spatial ...


0

With those test values you were given, it's clear that sanic is standing above ladybird (both points of the capsule have a larger y coordinate). Looking at the dot products confirms this: The dot product of AC and AB was -20, which is less than 0. From your notes: If this Dot Product is less than 0, that means the closest point from the line segment to C ...


6

More often than not: it's all for show. In Stone Librande's GDC 2013 talk "Simulating a City, One Page at a Time" he illustrates this with the original SimCity, where even on those primitive computers we had back then you could see individual cars driving around all the roads! Or could you? (See ~18 minutes in) As this close-up on the intersection shows, ...


0

At the moment you are checking for a collision between where the player is now and the goal square. Instead, you can define a rectangle which goes from where the player was last frame and where he is now. If there is a collision between this rectangle and the goal square this means one of three things: 1) The player collided with the square last frame (...


0

Generating collision from the mesh itself is the usual approach for terrain. This is especially not a performance issue on counter strike-sized maps, as long as you keep the vert density at a somewhat sane value (0.5-10m). If your level is already very geometric, or you need to have perfectly flat collision surfaces for some reason, look into replacing the ...


0

It looks like you are computing the axes correctly, so I doubt that is your problem. First, a couple of asides you may not be aware of: It is possible for you to get degenerate cases in SAT, in the case of computing the cross product of two parallel axes. In such a degenerate case, you do not attempt to compute the min/max, and just pass over the axis. ...


0

I don't know if this helps, but in my case i was raycasting and found a neat set of key value pairs to my aid: var result = space_state.intersect_ray(origin, get_global_mouse_position(), [self, owner]); If the colliding object is a tilemap, there is a entry called 'metadata' which contains the coordinates (in terms of tilemap coordinates) of that tile ...


0

Thanks for sharing your axis values. It revealed that you have more parallel axes than we'd expect from two rotated boxes, suggesting that you're computing the projection axes incorrectly. It looks like the problem is here: //normal of x axis of this body vector3 A0 = vector3(GetModelMatrix()*vector4(AXIS_X,1.0f)); normalList.emplace_back(A0); //normal of ...


Top 50 recent answers are included