Questions in topic: "geometry"
http://answers.unity.com/questions/topics/single/1488.html
The latest questions for the topic "geometry"Calculating surface area of a plane covered by cameras' frustums
http://answers.unity.com/questions/1679765/calculating-surface-area-of-a-plane-covered-by-cam.html
Hello, I am currently working on an application where I need to find the surface area covered by one (or more) camera FOV. The end goal is to be able to determine which potential camera spots would cover the most surface area of a floor, and eventually, with two or more cameras, cover as many angles so an object the player may be holding is in view as with as lateral and rotational movement possible. There's also a few obstructions that could be in place to block parts of the view as well. Essentially, I want to be able to build a room/layout then find the best spots for a camera to be placed for maximum impact.
So far I've tried breaking the floor plane down into vertices and raycasting from the camera spot to each vertices and testing the angle of the line to make sure it's within the camera's FOV, but this seems to get a bit expensive when I try and increase the number of spots to test/vertices in the floor. I also want to eventually be able to test volume coverage rather than just the floor's surface, but before I attempt that, I was hoping someone may have a more efficient method of "scoring" a potential camera spot. Thanks for any help!mathgeometrysurfaceareafovSat, 23 Nov 2019 05:51:11 GMTGiantDwarf01Geometry for normal mapping
http://answers.unity.com/questions/1672165/geometry-for-normal-mapping.html
Hello, dear community,
I'm making a mobile game for the first time and I have never been baking a normal map before. Now I have Meshes that have about 70 000 triangles and of course, I need to retopologize them down. The Unity documentary suggests about 300 - 1500 polygons per mesh, and I would like to have something about 400 polys since I am planning to have ten or more avatars in one level.
But I'm not sure what would be a good geometry for a retopologized avatar so that it looks - almost - equal to the high poly avatar after baking the normals.
In the following video they create a low poly avatar even without the nouse and eyes which the high poly avatar has, and, after baking normals it looks almost equal: https://www.youtube.com/watch?v=ApzVWuPa4A4
In the images below, you can see one of my high poly avatars and the low poly draft. The low poly is not ready since I didn't! create the body yet. But would the geometry give good result for the normal map?
Yours Rajageometrynormal mapTue, 15 Oct 2019 21:34:31 GMTrajaleneweitEllipticall Orbit like Spaceflight simulator
http://answers.unity.com/questions/1665884/ellipticall-orbit-like-spaceflight-simulator.html
I'm making a game relying on 2D rockets that orbit planets and shoot each other.
I would like to be able to predict and draw the rockets trajectory from the positions of the planets, the velocity and mass(within a sphere of influence) like in spaceflight simulator. it doesn't need to be exact, but a closed loop when it comes to the elliptical shape would be nice, so I'm guessing this is more geometry that physics. I have looked everywhere and can't find a simple, strait-forward formula. And I'm sure it's out there because so many simulators predict orbits from current state vectors. I'm not a physics or algebra wizz, but I am always happy to learn(so an explanation would be awesome if possible). Could someone help me out? or just provide me with a formula and ill try my best to figure it out.physicsorbitgeometrytrajectoryspaceflightTue, 17 Sep 2019 07:54:09 GMTwonkyCircumflexHow do i make my terrain able to use tangent geometry
http://answers.unity.com/questions/1662670/how-do-i-make-my-terrain-able-to-use-tangent-geome.html
I'm using unity 2019.2.3f1 i'm trying to apply ground texture to my terrain so i can start making the land and add tree and rocks, every time i put my material tho any of them , I get that message "Can't Use Materials With Shaders Which Need Tangent Geometry on Terrain, Use Shaders In Nature/Terrain instead" even making a new material from scratch same thing. I know i'm missing something since i'm new to this but i can't continue until this problem is fixed i've search around and i have found no answers, i've seen people ask the same question with no resolution. if anyone knows to to fix this problem it would be extremely helpful.shaderterrainhowgeometrytangentTue, 03 Sep 2019 02:19:42 GMTdbzloverjamCircle-line Intersection Points
http://answers.unity.com/questions/1658184/circle-line-intersection-points.html
Hi. As you can see from the image i have a line and start/end points of that line. how can i find the 2 points where line intersects with the circle.
i've found a post on a website and a video tutorial but i can't implement it in Unity because i am noob. can someone help please?
[website post](https://www.analyzemath.com/CircleEq/circle_line_intersection.html),
[video tutorial](https://www.youtube.com/watch?v=OuAhkinZVsU)
![alt text][1]
[1]: /storage/temp/144693-img.pngmathlinecirclegeometryintersectionFri, 16 Aug 2019 13:01:23 GMTFerrissi have a line that goes through a circle. how can i find intersection points?
http://answers.unity.com/questions/1657918/i-have-a-line-that-goes-through-a-circle-how-can-i.html
Hi. I have an point on edge of a circle and a direction where that point facing. When i draw a ray from that point i want that line to end at other edge of circle but i don't know how can i calculate that point because that line does not go from center(if it would then length of line would be same as diameter of circle). if i can find the other point then i can calculate the length of it by using chord of circle formula which is what i actually need.
![alt text][1]
[1]: /storage/temp/144629-imgg.pngmathgeometrycirclesThu, 15 Aug 2019 12:05:30 GMTFerrissHow to set thickness to terrain plane
http://answers.unity.com/questions/1657557/how-to-set-thickness-to-terrain-plane.html
very simple question and can't seem to find this anywhere, the terrains in unity are a simple plane, is there a way to, for example, instead of a plane use a cube or a parallelepiped, and the top surface of that object would be the terrain where we can edit elevations and details?terraincubeterraindatageometryterrain-editorTue, 13 Aug 2019 21:51:24 GMTSerge144i want to create a triangle from 2 3d vectors
http://answers.unity.com/questions/1628415/i-want-to-create-a-triangle-from-2-3d-vectors.html
Hi i am trying to do a triangle from 2 given 3d vectors and i want the triangle to be symetrical and i dont know how to get the last 3d vector
and with symetrical i mean the sides are equal lengthc#mathgeometrySat, 04 May 2019 12:01:03 GMTeliyahRender Transparent Geometry
http://answers.unity.com/questions/1606440/render-transparent-geometry.html
Hello,
I Have **Render Transparent Geometry() taking 120 ms** in the profiler ! Too much!
----------
**How can I reduce it?**
I heard something about the Filter mode? I have some big background textures with the top part which is all transparent, should I cut it out? I didn't do it in order to maintain a squared compressed file format. Is it a bad choice?texturerenderingrendererprofilergeometryMon, 25 Feb 2019 22:07:56 GMTLeleUnityC#. Inappropriate mesh vertex coordinates returned by another class
http://answers.unity.com/questions/1604656/c-inappropriate-mesh-vertex-coordinates-returned-b.html
Hi all,
<br> <br>
I have made two scripts, one which retrieves geometrical information from an object, such as mesh vertex position, and another script which prints out this information to an XML.
<br> <br>
**Problem**:<br>
When I print out the information and instantiate spheres for debug purpose based on information that I am retrieving directly via button from geometry information script, everything is correct as it should be.
<br> <br>
When I reference the geometry information script from my XML print script, the outputted coordinates of vertices are as if the object was positioned on X=Y=Z=0 with scale of 1
<br> <br>
I suspect this has something to do with what kind of information has been passed into the Geometrical Information script when it's triggered via XML print script.
<br><br>
Script which prints and processes geometrical data retreived from Geometry script. This gives me data as if the relevant game object was on X-Y-Z=0c#verticesgeometryThu, 21 Feb 2019 11:17:06 GMTJollyJumpingBeanPoint on a Plane between two points
http://answers.unity.com/questions/1602880/point-on-a-plane-between-two-points.html
I have a Plane (the class not the gameobject) and two Vector 3 positions.
I am trying to find the point on the line between the two positions that also intersects the plane.
My best idea at the moment is creating a custom plane class that stores the equation of the plane and working it out using algebra however I feel like there is likely a simpler way.
Thanksvector3planegeometrySun, 17 Feb 2019 18:13:00 GMTMomentsStudioImport colliders from Blender
http://answers.unity.com/questions/1602394/import-colliders-from-blender.html
Does Unity have any option to import basic colliders from Blender? I mean, maybe modelling a cube in blender, assigning it any tag or something, so when I import, Unity recognizes those basic objects as colliders.
I know about the mesh collider, but it consumes a lot of resources, so I'm looking for a way to working faster with basic colliders. Thanks!blendercollidersblender-exportinggeometrySat, 16 Feb 2019 13:32:24 GMTNiedon2Domain shader create geometry
http://answers.unity.com/questions/1590034/domain-shader-create-geometry.html
Hi there,
I'd like to create geometry using a domain/hull shader, such that for each triangle of the input mesh I can generate one or several other triangles. I know it's possible using a geometry shader, however these aren't supported on metal.
Could someone give me an example for this? Because it's not so well documented.shadergeometrygeometry shaderMon, 14 Jan 2019 11:34:00 GMTcoen22How to make an object always stick to a mesh?
http://answers.unity.com/questions/1565893/how-to-make-an-object-always-stick-to-a-mesh.html
Hello, i am developing a racing game. But it's not your usual racing game, the bike is supposted to always have the Y coordinate of the same value as the closest point on the map mesh, in other words it is ALWAYS touching it.
What i do not want is the Y coordinate to be dependent upon the X and Y position, as there will be 2 (or maybe more floors).
I have absolutely no idea how to implement this. Completly zero. I am rather new to scripting, and this i way out of my league, i don't even know how to start... The map is not a simple plane, so simple maths won't help. I'll apreaciate any help at all, not necessarily a solution.
Thanks in advancephysicsscripting beginnergeometryThu, 25 Oct 2018 19:43:19 GMTKoteuHow to project a point on to a sphere?
http://answers.unity.com/questions/1545371/how-to-project-a-point-on-to-a-sphere.html
If i have a point (x,y,z) how to project it on to a sphere(x0,y0,z0,radius) (on its surface). My input will be the coordinates of point and sphere. The output should be the coordinates of the projected point on sphere.
I found an answer! :D
public Vector3 ProjectOnSphere(Vector3 OriginalPosition, Vector3 SpherePosition, float radius)
{
Vector3 p = OriginalPosition - SpherePosition;
float pLenght = Mathf.Sqrt(p.x * p.x + p.y * p.y + p.z * p.z);
Vector3 q = (radius / Mathf.Abs(pLenght)) * p;
Vector3 pointOnSphere = q + cameraPosition;
return pointOnSphere;
}programmingmathgeometryprojectionalgebraThu, 23 Aug 2018 08:50:04 GMTartak10tMorphing geometrical shapes
http://answers.unity.com/questions/1533331/morphing-geometrical-shapes.html
Hello everyone,
Maybe someone can help me. I need to make morph from 1 geometrical shape to another. In best case it should be smooth morphing animation. I know that in 3ds max present modificator that allow to make morphing but it works only with objects that have absolutely same topology and polycount/vertexcount.
Will be glad to hear any ideas or suggestions.
Thanks
![alt text][1]
[1]: /storage/temp/121459-q.jpganimationtransformgeometrymorphmorphingTue, 24 Jul 2018 08:17:02 GMTtonnynevelConfused about local, world coordinates when it comes to child objects...
http://answers.unity.com/questions/1523734/confused-about-local-world-coordinates-when-it-com.html
OK. I got a cube. And the cube has a child cube. **Cubey**.
I also have a **point** on the surface of Cubey--and I need to know which *face* of Cubey that point is on.
That's not the problem--I figured out that if I compared the angles between the directional vectors from each of Cubey's faces to the point's vector then any angle less than 45 degrees means my surface point is on that side. For example:
If: **Mathf.Abs(Vector3.Angle(surface_point,cubey.transform.right)** is less than 45 degrees, my surface point is on the *right* side. If it's > 45 degrees, it's round the next corner. (Let's not get into edge cases).
This works fine. *As long as Cubey shares the same position as his parent cube.* Once Cubey moves away, things get inconsistent.
So--something to do with world vs local space I'm sure. But no matter what I do I can't figure out how to correct it. I've converted surface point to local but it doesn't fix it.
I guess the problem is I'm having a hard time getting my head around just where the vectors here are actually going. For instance--if I convert my **surface point** coordinates to Local space (in other words, relative to the the Parent) does that mean I'm ending up with a vector from the parent's 0,0,0 point through the point on Cubey? That doesn't sound like what I need. It seems like I'd want a line from Cubey's 0,0,0 point to the point on his surface, and then I'd want to get the angle between that vector and the one also starting from Cubey's 0,0,0 but aiming along his right-transform. How do I do that for a child object? Seems all the vectors stem either world origin or parent origin.
I've read a lot on it, but I feel like I still have some fundamental misunderstanding when it comes to child object geometry--I'm really hoping someone can shed some light...?coordinateschild objectgeometryparent and childFri, 29 Jun 2018 22:40:09 GMTDana_BC# Recreating Blender's Skin Modifier in Unity
http://answers.unity.com/questions/1515303/c-recreating-blenders-skin-modifier-in-unity.html
Hi, I'm not sure how to approach creating a script that wraps around a group of points in unity, the end result would be something like blender's skin Modifier:
![alt text][1]
[1]: /storage/temp/118391-modeling-modifiers-generate-skin-example.png
,Hi, I'm not sure how to approach creating a script that wraps around a group of points in unity, the end result would be something like blender's skin Modifier:
[1]: https://docs.blender.org/manual/en/dev/_images/modeling_modifiers_generate_skin_example.pngmeshscript.spawngenerationgeometryThu, 07 Jun 2018 01:23:07 GMTgeorgetheonemakerHow to get the cross direction for 3 points?
http://answers.unity.com/questions/1503945/how-to-get-the-cross-direction-for-3-points.html
![alt text][1]
[1]: /storage/temp/116516-434a10f76b6e8fb452fe4ab983cc104f.png
How would I get the normal/cross from the three points marked in red? Assuming the points go in order 1, 2, 3 - Left to right.scripting problemgeometryWed, 09 May 2018 09:47:05 GMTHHammeriteHow to calculate the point at which two lines meet?
http://answers.unity.com/questions/1503613/how-to-calculate-the-point-at-which-two-lines-meet.html
![alt text][1]
[1]: /storage/temp/116476-bf1d5aa2ae63b28a02b0a0a511b0ec8c.png
So I'm making a procedural mesh which should always have the same width no matter the angle or direction of the corners in it. In order to ensure the width is consistent the middle (lowest) point has to reposition itself relative to the angle of the shape. Does anyone have any suggestions as to how this should be calculated, assuming all corners in this illustration have a point in space.
I'm sure the solution is simple, any help would be greatly appreciated :)geometryTue, 08 May 2018 14:43:18 GMTHHammeriteCan I transform all of my objects by referencing 2 points?
http://answers.unity.com/questions/1498255/can-i-transform-all-of-my-objects-by-referencing-2.html
My little VR application is nearly over. For geocoding, I want to transform the objects from local to geocoordinates by using 2 points (similarity transformation). Is it possible? If it's possible, how?unity 5coordinatesgeometrycoordinate-systemcoordinateTue, 24 Apr 2018 21:17:13 GMTtungakinCross with cubes using for?
http://answers.unity.com/questions/1494001/cross-with-cubes-using-for.html
How do I make a **for** roll these coordinates?
![alt text][1]
[1]: /storage/temp/115047-area.pngc#for-loopgeometrySun, 15 Apr 2018 00:50:54 GMTFokinhaasGetting position of a coordinate on the surface of a sphere
http://answers.unity.com/questions/1493550/getting-position-of-a-coordinate-on-the-surface-of.html
So I want to create a object B close to another object A, but I'm trying to avoid that A covers B:
![hides][1]
I have thinking how to achieve that. Take a look of the following drawing:
![not hide][2]
I have been thinking in a solution in a math - geometry way before searching for some Unity3D function to solve the problem. I have realise A and B would be on the same surface if the camera is within a sphere with radius c-A. So I guess the solution can be related to get a point at a B at a distance A-B from A on the surface of the sphere with radius c-A. Does it has sense? Any other idea? How to do it with maths and Unity?
[1]: /storage/temp/114934-asset-2.png
[2]: /storage/temp/114935-asset-1.pngpositioncoordinatesgeometryFri, 13 Apr 2018 21:10:16 GMTchelderMesh renderer turns off on runtime?
http://answers.unity.com/questions/1490302/mesh-renderer-turns-off-on-runtime.html
Hi,
I've created an app for the HoloLens using Vuforia. In this app, I've got multiple arrows as children of instructions within the ImageTarget.![alt text][1]
On runtime however the mesh renderer turns off making the objects invisible.![alt text][2]
If I move the objects from under the parent files they are working.
I just can't seem to find the problem, so if anybody has a bright idea :)
Thank you in advance,
~Danny
[1]: /storage/temp/114364-question-1-2.png
[2]: /storage/temp/114365-question-2-2.pnginspectorwindowsvuforiasettingsgeometryFri, 06 Apr 2018 12:08:19 GMTDanny-d-vTechniques for performance and issue with polar calculations
http://answers.unity.com/questions/1484916/improving-performance-using-many-gameobjects-and-f.html
I am trying to figure out the fundamentals of Unity by making what I thought was a simple project. The idea is that you have a square grid of cubes, and parts of the grid would burst up in sync with music to create an interesting audio visualizer. I am trying to get it working at random points and will do the music part later. Right now, it works perfectly on some settings, but when the circle "radius" gets too big, it doesn't appear to work correctly. The effect that i'm going for is similar to this video (but with a fixed focal point, it should not oscillate but rather go through one cycle): [Example video][1]
I also want to make sure since i'm learning Unity that I am being efficient in how I do things. Right now I have a rough idea of C# syntax, so for simplicity I iterate over two (2D?) arrays. There are probably better techniques to do what I am doing, so if you can provide optimizations for a beginner that would be very helpful. I am not sure why the radial ripple effect doesn't work on large values (try 15 gridsize, 3 cubesize, 1.5 growth interval, 25 growth size, and 5 shrink rate to see what I mean). Here is my entire code, which is attached to a standalone object:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeGenerator : MonoBehaviour {
public GameObject whiteCube;
public GameObject blackCube;
public int gridSize;
public int cubeSize;
public float growthInterval;
public float growthSize;
public float shrinkRate;
private GameObject[,] cubes;
private bool[,] grownCubes;
private int shrinkScale;
void Start () {
shrinkScale = 3;
//Scale the cubes based on the grid and cube size
whiteCube.transform.localScale = new Vector3(cubeSize, cubeSize, cubeSize);
blackCube.transform.localScale = new Vector3(cubeSize, cubeSize, cubeSize);
cubes = new GameObject[gridSize, gridSize];
grownCubes = new bool[gridSize, gridSize];
for (int x = 0; x < gridSize; x++) {
for (int z = 0; z < gridSize; z++) {
if (x % 2 == z % 2) {
cubes[x, z] = (GameObject)Instantiate(whiteCube, new Vector3 (x * cubeSize, (float)cubeSize / 2, z * cubeSize), Quaternion.identity);
} else {
cubes[x, z] = (GameObject)Instantiate(blackCube, new Vector3 (x * cubeSize, (float)cubeSize / 2, z * cubeSize), Quaternion.identity);
}
grownCubes[x, z] = false;
}
}
}
//Randomly grow a cube at this interval (seconds)
float nextTime = 0;
void Update () {
if (Time.time >= nextTime)
{
int magnitude = (int)growthSize / cubeSize;
Vector3 initialPosition = transform.position;
Vector3 growth = new Vector3(0, growthSize, 0);
int randomX = Random.Range(0, gridSize);
int randomZ = Random.Range(0, gridSize);
//ScaleObject(cubes[randomX, randomZ], growth, 1);
for (int radius = 0; radius < magnitude; radius++)
{
if (radius > 0)
{
int angleDelta = (int)(360 / (4 * radius));
for (int degrees = 0; degrees < 360; degrees += angleDelta)
{
int x = (int)(radius * Mathf.Cos(degToRad(degrees))) + randomX;
int z = (int)(radius * Mathf.Sin(degToRad(degrees))) + randomZ;
if (x >= 0 && x < gridSize && z >= 0 && z < gridSize && grownCubes[x, z] == false)
{
grownCubes[x, z] = true;
ScaleObject(cubes[x, z], growth * Mathf.Pow((float)2 / 3, (float)(radius)), 1);
}
}
}
else
{
ScaleObject(cubes[randomX, randomZ], growth, 1);
}
}
nextTime += growthInterval;
}
//Always shrink cubes if they are over the initial size
foreach (GameObject cube in cubes)
{
if (cube.transform.localScale.y > cubeSize)
{
Vector3 shrink = new Vector3(0, Mathf.Min(shrinkRate, cube.transform.localScale.y - cubeSize) * Time.deltaTime * shrinkScale, 0);
ScaleObject(cube, shrink, -1);
}
}
for (int x = 0; x < gridSize; x++) {
for (int z = 0; z < gridSize; z++) {
grownCubes[x, z] = false;
}
}
}
void ScaleObject (GameObject obj, Vector3 scalar, int direction)
{
obj.transform.localScale += direction * scalar;
obj.transform.position += (direction * scalar) / 2.0f;
}
float degToRad (float degree)
{
return (float)degree * Mathf.PI / 180;
}
}
Thank you for bearing with me.
[1]: https://videoblocks-content.s3.amazonaws.com/video/preview/jFnaQEy/videoblocks-black-boxes-with-shining-edges-create-smooth-ripples-loop-ready-animation-of-dark-cubes_bfjqzigug__PM.mp4optimizationgeometrysyntaxcubesradialSat, 24 Mar 2018 23:13:38 GMTadapapGet / Calculate edges of a 3D object - C #
http://answers.unity.com/questions/1479563/get-calculate-edges-of-a-3d-object-c.html
I need to get all vertices in the edge position of a determinate object 3D (in this case a path).
See the image:
![alt text][1]
My question is, how can I get only the edges vertices, like the image?
[1]: /storage/temp/112881-questao-vertices-en.pngc#mathgeometryMon, 12 Mar 2018 22:54:31 GMTgabrieltvaLarge # of gameobjects run smoothly or alternative?
http://answers.unity.com/questions/1479203/large-of-gameobjects-run-smoothly-or-alternative.html
I have been working on a building game project in unity, a Lego sort, and one problem that I have recently come across is size. Small numbers of these bricks go together with little lag, but then the frames drop as the brick count increases:
![alt text][1]
[1]: /storage/temp/112824-problembricks.png
This image has about 1k bricks on the beautiful settings.
The bricks themselves have triggers on them that act as stud connections, and each brick has some script that handles connections and other such, all parented to an empty with a rigidbody (Set to isKinematic for now, so physics aren't playing a role in my frames). I would really like to know if there's a way to optimize this to allow for large scaling in the 10's of thousands of bricks, some trick about Unity's rendering/processing settings I don't know about, or maybe some mesh connection?
Any help would be appreciated, even if it the answer is find another engineoptimizationgameobjectsgeometrytrisMon, 12 Mar 2018 04:50:16 GMTSeaLeviathanCalculating mesh area
http://answers.unity.com/questions/1474675/calculating-mesh-area.html
I have a game with the shape slicing mechanics.
I need to get the area (it's in 2D) of the each slice. Each slice has Mesh, PolygonCollider2D and RigidBody2D.
How can I get a slice area using existing components?
The area must represent actual object size on screen and should know about object scale.
Rect and bound solutions don't have a good accuracy with complex shapes like stars. So I'd already tried them.meshgeometrycalculationsWed, 28 Feb 2018 15:45:10 GMTinterpol_kunfind point projection on circle around another point
http://answers.unity.com/questions/1463661/find-point-projection-on-circle-around-another-poi.html
Hello
![alt text][1]
-red is player position
-blue are objectives position
-orange are the points i need to find, always positioned on the black circle around the player, even if the objective point is inside of it.
How can i do it?
Thaaanks <3
[1]: /storage/temp/110615-immagine.jpggeometrySat, 03 Feb 2018 11:12:57 GMTcattagamesHow to see geometry
http://answers.unity.com/questions/1451594/how-to-see-geometry.html
So. ![alt text][1]
[1]: /storage/temp/108758-anyway.png
I am making a game with no textures (I just make and paint objects with basic colors in Sketchup then export them straight into Unity), but I am facing this one problem, that is, geometry cant be seen in dark, is there any way to deal with it other than use textures?geometrynot showingSun, 07 Jan 2018 15:42:58 GMTBlAcK_BlAcKiTo