Questions in topic: "equation"
http://answers.unity.com/questions/topics/single/7321.html
The latest questions for the topic "equation"Any Ideas on how to solve this?
http://answers.unity.com/questions/1573298/any-ideas-on-how-to-solve-this.html
I am relatively new to coding and unity and I was following a guys tutorials on how to make a clicker style game. His code on one of his videos were very buggy and it would always go into the negative if you bought an auto seller, which is an update in the game. I fixed all of bugs that would put you in negative but I am stuck trying to find out a way to solve another bug. What I am currently using is an IEnumerator function with if statements inside. The bug that I am facing is when you hire sellers that sell the ore and they are trying to sell an amount that is bigger than is being made. What happens is it takes away the ore, but it does not credit you for only selling partial of what the miners sell every second. I am trying to find a way that it can sell the amount of ores that is < than the number of sellers. I tried doing an if and else statement inside of another else statement but it freezes all of my code that is inside of the IEnumerator and I am confused on how to fix this. Anyone have an idea on how to fix this issue?mathif-statementsienumeratorelseequationTue, 20 Nov 2018 01:16:55 GMTunity_0sdsWZad6Fwp-ABoyle's law
http://answers.unity.com/questions/1534298/boyles-law.html
I want to create an illustration of Boyle's law in which the volume of a balloon changes proportional to depth, (ie y value). Can anyone give me some help on this. thanks moyraequationThu, 26 Jul 2018 08:15:36 GMTMoyraCampbell52D kinematics
http://answers.unity.com/questions/1489602/2d-kinematics.html
I am trying to make a calculator and for some reason the time is not showing right. Am I doing something wrong with my equations? I get 1.73 and the online calculator gets 1.44... My angle is 45 degrees and my velocity is 10 m/s
vx = float.Parse(velocity.text) * Mathf.Cos(float.Parse(angle.text));
vy = float.Parse(velocity.text) * Mathf.Sin(float.Parse(angle.text));
time = ((2 * vy) / g);
distance = vx * time;
print(time);
![alt text][1]
[1]: /storage/temp/114265-referencecalc.pngphysicsphysics2dmathequationWed, 04 Apr 2018 17:56:43 GMTRoman1224Vector equation for dragging a Quad billboarding the Camera
http://answers.unity.com/questions/1432381/vector-equation-for-dragging-quad-billboarding-the.html
I am trying to implement method which allows the user to click on a quad with the mouse, and drag it around. While being dragged, the quad should be facing / billboarding the camera.
<br>
After several tries at this method which worked out more or less good, I finally found out where my confusion came from. The correct center point position is needed, but obtaining it can only be done through an equation solving with the giving parameters. But this is where my math fails me. Any help finding this equation would be greatly appreciated.
<br>
Please see the picture below for illustration. It's a 3D world, but for the sake of simplicity the picture is in 2D.
<br>
The user clicks on the quad, which gives the 3D point where the quad was hit and the direction from the camera to it. Dragging the quad around should now orient it facing the camera, constantly billboarding it at the same distance while being dragged and using its center point (A) for pivoting.
![alt text][1]
<br>
This gives three values which can be used:
- The direction from the cam to the quad point that was clicked on with the mouse
- The distance between the camera and the center point of the quad, when it was clicked on.
- The size of the quad (and the distance between its center point and the point where it was clicked)
<br>
The problem can probably be solved by finding the position where the quad center point is at the required distance and maintaining its offset to the drag point where the user clicked it. So basically, given the mousepointer direction and the quad size, the position of the quad center point is needed where it intersects the circle around the camera of the given distance.
<br>
Any help how to come up with that equation would be greatly appreciated.
[1]: /storage/temp/105583-draggablequad.jpgvectorequationperpendicularbillboardingTue, 14 Nov 2017 22:31:16 GMTBamfaxWriting maths expressions
http://answers.unity.com/questions/1429629/writing-maths-expressions.html
Hi I am currently needing to go beyond maths expressions requiring just simple indices to be displayed and instead roots, fractions and formulas.
Has anyone found an efficient way of doing this?
An example: 1/4^5 as a fraction or 1/square.root:4^5 - but both of course written as proper fractions with square root symbols displayed.
TextMeshPro has inbuilt indices functionality but that's it as far as I've found it goes in markup docs.
I've found the only option so far to be: https://www.assetstore.unity3d.com/en/#!/content/51426
Anyone had success without purchasing assets?fpsassetsmathequationsquare rootSat, 04 Nov 2017 18:04:50 GMTLukeRobertsRigidBody 2D x velocity function
http://answers.unity.com/questions/1414162/rigidbody-2d-x-velocity-function.html
This isn't really a suuper unity-related question, but i was hoping someone with math / physics background could provide me to the mathematical function that gives the velocity decline of a single axis in the Rigidbody 2D componet.
The component i'm talking about is the one in the screenshot below.
When you set the x velocity of a rigid body it slowly slows down, the affect is called drag i think, and it uses the variables in the inspector to decide how fast/slow it will slow down. I just need the mathematical equation for this. If you can help me then please do.
I need to calculate the drag myself for special reasons.
![alt text][1]
[1]: http://puu.sh/xMsVx.pngphysicsrigidbodyfunctionmathequationSat, 30 Sep 2017 09:19:49 GMTIssunNeed help with easing effects which respect Time.deltaTime, MATH
http://answers.unity.com/questions/1405949/need-help-with-easing-effects-which-respect-timede.html
Hi, I'm trying to implement some easing. Now that I'm developing in Unity, I want to use start-location independent eases like this which respect Time.deltaTime (the amount of time which has passed since the last frame). This is a Math question
So far, I've had success using (Time.deltaTime / 0.007f) to get an idea how many times slower the application is running compared to 144 HZ/FPS (1/144 = 0.007).
At 30 frames per second, (Time.deltaTime / 0.007f) ~= 4.8, meaning all my easing math can be scaled by this amount. This works in other locations, such as slowing objects down with ease consistently across all frame-rates:
physics.velocity *= Mathf.Pow( 0.8f, Time.deltaTime / 0.007f)
The above code works, but I can't figure out the next equation. I used to use code like this to ease a variable towards its target every frame.
X = X + (targetX - X) / 20;
I've tried taking some stabs at it, but I can't get Time.deltaTime factored into the above equation. Are there any gifted mathematicians who could help me, or shed light on ways to accomplish this more easily?timemathdeltatimeeasingequationTue, 12 Sep 2017 05:02:51 GMTWallHackJackUnity transform.forward issue
http://answers.unity.com/questions/1401099/unity-transformforward-issue.html
When I rotate a character to say 0 deg, or 180 deg, it's "forward" shows clearly X = 0, Z = 1/-1. However if I rotate the character to 90/-90 or 270/-270, it's forward shows X = 1/-1, but the Z always shows "-1.192093e-07"... And I also noticed that the debug rays that calculate from the forward go every which way, mainly the one ray shoots down into the ground. I am assuming that this is because Z is not equaling zero, when my character is rotated toward the east/west position.
Is there a issue with unity's rotation calculations? Or is there a separate trick that I must modify the Z to zero myself?
*NOTE: Using unity 5.6.3p1, which should be most recent update. This is done in the inspector, whilst game is running. So my 90 and 270 are absolute degrees, no miscalculations. And a public Vector3 = transform.forward, should be showing accurate...unity 5vector3issuerotation axisequationThu, 31 Aug 2017 13:10:45 GMTWideEyeNowWhat is using equation for SpringJoint solver?
http://answers.unity.com/questions/1396578/what-is-using-equation-for-springjoint-solver.html
I'm creating physics pazzles with SpringJoint.
I cannot find a solver equation for SpringJoint.
I guess Unity SpringJoint is using a Hock's law, but It's not same resulting.
I've tried to use SpringJoint below.
1. Create a SpringJoint as anchor.
Parameters are:
- Spring = 1000
- Damper = 50
And I attached a Rigidbody to it with IsKinematic is true.
2. Create a box object with Rigidbody.
parameters are:
- Mass = 10
I've calculated as Hock's law,
F = -kx
10[Kg] * 9.8[m/s^2] = -1000[N/m] * x[m]
x = 0.0908[m]
But the result is `0.117...`. It's not same.
It is wrong? or Unity has other equation for the spring?physicsalgorithmspringequationMon, 21 Aug 2017 03:19:08 GMTedo_m18does anyone know how can i draw or create atoms?
http://answers.unity.com/questions/1346795/does-anyone-know-how-can-i-draw-or-create-atoms.html
i'm trying to create atoms for balancing equations, as if there a character and it's trying to balance the equation showing in front of it in atoms form and the equation itself is showin' on the board as if the character in a class or lab maybe.equationbalanceSun, 30 Apr 2017 10:16:15 GMTasmaaredaRelative Position Not Constant?
http://answers.unity.com/questions/1343410/relative-position-not-constant.html
Hi,
As part of a project I'm doing, I need to model a ball with three accelerometers attached to it in Unity. To do this I've created a sphere that can be controlled through keyboard input, and attached three very small cubes to it at different points. I need to collect the positions and angular velocities of all four objects. Collecting the angular velocities require me to attach a rigid body component to each object, which prevents me from making the cubes children of the sphere.
<br>
<br>
Now because I can't utilize the parent-child relationship I've had to attach a hinge component to each of the three cubes and used them to link the cubes to the sphere. My issue now is this. I want to also collect the location of the cubes with respect to the spheres local coordinates at a given sampling rate. I expected this to be a constant value for every sample since the sphere and cubes move together simultaneously and so, from the perspective of the sphere, the cubes are not changing position at all.
<br>
<br>
**But for some reason I get the positions of the cubes with respect to the spheres local coordinates to be a changing quantity. Why is that? Have I misunderstood something about this situation or is there an issue with my code, given below? Is it because I attached the cubes to the sphere using a hinge and so the cubes are not truly fixed, i.e. have small rotations/movements around the placement point?**
<br>
<br>
I'm truly at a loss here and I appreciate any help you can offer. Even just pointing me in the right direction would be great. Thanks in advance!
<br>
// "other" is a GameComponent that refers to the sphere object
// This script is attached to a single cube to transform.position refers to one cube
Vector3 d = transform.position - other.transform.position;
Vector3 rel = Vector3.zero;
rel.x = Vector3.Dot(d, other.transform.right.normalized);
rel.y = Vector3.Dot(d, other.transform.up.normalized);
rel.z = Vector3.Dot(d, other.transform.forward.normalized);
com.Add(rel); // com is a List that holds all the sampled positionsc#scripting problemmathrelative positionequationThu, 20 Apr 2017 23:35:07 GMTjohnnyBoy1986heavy calculation in the cloud
http://answers.unity.com/questions/1335259/heavy-calculation-in-the-cloud.html
Hey,
I am currently solving some linear equations on the devices itself. But with more complex equations the time needed is steadily increasing. Therefore I wanted to push these equations to a Webservice (such as Amazon Web Services HPC) and get all the computations done there. But I literally have no experience with that, so I was wondering whether anyone could point me to some kind of guide/tutorial that could help me get started.cloudwebserviceequationTue, 04 Apr 2017 10:45:03 GMTfred_gdsExplosion damage script only deals damage in the first explosion and none afterwards
http://answers.unity.com/questions/1293224/explosion-damage-script-only-deals-damage-to-enemi.html
I have a script that takes all gameobjects in the scene, and if they have a damage detector and is within the radius of the explosion damage, deals damage to them. This works fine for just the first explosion I deal near the enemy, but not anything else.. Note the first explosion is far away from the player, so the player should not be affected by it.... Every explosion has this script on it.
foreach (GameObject item in EntitiesDataBase.GameObjects) {
if (Vector3.Distance(item.transform.position, transform.position) < ExplosionDistance) {
if (item != null) {
if (item.GetComponent<Rigidbody>() != null) {
item.GetComponent<Rigidbody>().AddExplosionForce(ExplosionForce, transform.position, ExplosionDistance); // Just incase this is stopping the script with an error.....
}
if (item.GetComponent<DamageDetector>() != null) {
float Damage = 0;
float Distance = Vector3.Distance(transform.position, item.transform.position);
// Make an equation between distance and damage
Vector2 Pos1 = new Vector2(0, MaxDamage);
Vector2 Pos2 = new Vector2(ExplosionDistance, 0);
float SlopeN = Pos1.y - Pos2.y; // Numerator
float SlopeD = Pos1.x - Pos2.x; // Denominator
float YIntercept = MaxDamage;
float Slope = SlopeN / SlopeD;
Damage = Distance * Slope + YIntercept;
item.GetComponent<DamageDetector>().Health += -1 * Damage;
}
}
}
}
"Damage Detector" is a universal script I use for detecting damage for other scripts to use.
`EntitesDataBase.GameObjects` is an array that when a gameobject not in the array already is found, it adds it (so each gameobject has a unique ID number, results in some/most gameobjects being null)
The values that I have it set to, incase that has anything to do with it, is the following
ExplosionDistance = 20;
MaxDamage = 100;c#mathdamageexplosionequationMon, 02 Jan 2017 18:19:07 GMTCreeper_MathIssues wrapping my brain around this math
http://answers.unity.com/questions/1250591/issues-wrapping-my-brain-around-this-math.html
This is a problem for you math wizards that I have been stumped on for a while even though I feel like I should be able to solve it.
**What I am doing :** I am taking an image, or rather, float[,] values from an image and putting them into an array. From that array I am "upressing" the values so that the range of values turns into a larger pool. From there I am dividing it up into chunks. This is for terrain generation.
So for this example.
- N = 512 (the original input
dimensions. 512*512)
- Up = 5 (the upres amount)
- Cs = 512 (The chunk dimensions.
512*512)
- Ms = N * Up (The total dimensions of
the upresed array. 2560*2560)
- Gs = Ms/Cs (The grid dimensions. 5*5
chunks)
Currently I am upresing the entire thing all at once. What I want to be able to do is upress only the necessary areas. As you can imagine, upressing a 512*512 image 50 times (25600*25600) would take a while to process a lot of unnecessary data...especially when its going to be representing terrain that the player wont be near.
**Where I fail:** I need to be able to access the specific values that are getting upresed into the chunk dimensions (512x512) from the original input (N) and upres only those. I cant have float values and I cant be rounding. The values exist and are being upressed, I just cant think of a way to reverse this process.
**Conclusion:** I want to collect only the necessary values from the original input and pass those to be upresed instead of unpresing the entire original input array.
Here is the code I am currently working with.
float[,] originalInput; // an array containing the original values, im using 512*512 (N)
int upres = 5; // how many times the original values are upres (Up)
originalInput = UpresHeights(originalInput, upres); //upres the input
int mapsize = originalInput.GetLength(0); // (Ms)
int chunkSize = 512; //(Cs)
int gridSize = (int)Mathf.Round((mapsize / (float)chunkSize)); //Grid size (Gs)
float[,] UpresHeights(float[,] oldHeights, int upres)
{
//Duplicate the array input array
int originalHeight = oldHeights.GetLength(0);
float[,] heights = new float[originalHeight, originalHeight];
for (int y = 0; y < originalHeight; y++)
{
for (int x = 0; x < originalHeight; x++)
{
float val = oldHeights[x, y];
heights[x, y] = val;
}
}
//Upres the new array
int heightsLength = originalHeight;
int resolution = (heightsLength * upres);
float[,] newHeights = new float[resolution, resolution];
for (int y = 0; y < originalHeight; y++)
{
for (int x = 0; x < originalHeight; x++)
{
//The original input is tileable, so the following
//just makes sure to sample from the opposite side
//of the array if at the border
float right = 0.0f;
if (x == originalHeight - 1)
{
right = heights[0, y];
}
else {
right = heights[x + 1, y];
}
float top = 0.0f;
if (y == originalHeight - 1)
{
top = heights[x, 0];
}
else {
top = heights[x, y + 1];
}
for (int xx = 0; xx < upres; xx++)
{
for (int yy = 0; yy < upres; yy++)
{
//smooth the values (could use vector2.distance,
//but this isnt important right now)
//not that important since blur is applied later
float a = Mathf.Lerp(heights[x, y], right, (xx / (float)upres));
float b = Mathf.Lerp(heights[x, y], top, (yy / (float)upres));
newHeights[x * upres + xx, y * upres + yy] = (a + b) / 2f;
}
}
}
}
return newHeights;
}mathstuckformulaequationstupidSat, 01 Oct 2016 18:14:26 GMTb1gry4nTrying to get perfect jumps with Character.
http://answers.unity.com/questions/1248756/trying-to-get-perfect-jumps-with-character.html
Hello, I am making a game that needs my character to jump very specifically. Visualize this cube as the character.
![alt text][1]
For instance, if the cube is traveling forward with a velocity of 10m/sec, and there is no friction, I need to figure out a jump velocity to get it to jump up, and fall down a third of its height.
![alt text][2]
Maybe I shouldn't be using velocity, but I solved for the initial velocity to be 12m/sec when the gravity = 24m/sec^2. With my calculations the cube should reach y = 3m, at its maximum, but instead it gets up to 2.9. This is not good enough, because over a period of time it will become too far off the target. I turned off all drag, and it still reached 2.9m. Is there drag other than "Drag", and "Angular Drag"? I am quite sure my physics calculation is correct, but there has to be as problem somewhere.
V = final velocity
Vo = initial velocity
a is acceleration or gravity
d is the distance traveled
V = 0m/sec because that is the max height
Vo = is what I am looking for
a = -24m/sec2 as I stated
d = the distance traveled y so 3m is what I want
V^2 = Vo^2 + 2a x d
Vo^2 = 2(-24m/sec^2) x 3m
Vo = √(144m^2/sec^2)
Vo = 12m/sec
Once the height is exactly 3 then it should be easy to solve for the distance "x". I just don't know why the number is off. I made these specific values so I could have a real number, "3". So, it is quite useless to get 2.9.
Maybe there is a way easier way to do this. If so let me know.
[1]: /storage/temp/79006-slimerbrick.png
[2]: /storage/temp/79007-drawing.pngphysicsvelocityjumping objectequationTue, 27 Sep 2016 00:53:58 GMTPayton-DugasHow do I make unity generate a random equation and an answer to to it (also making it show on the screen?)
http://answers.unity.com/questions/1177323/how-do-i-make-unity-generate-a-random-equation-and.html
Hi, so what I am doing here is making a math game (for a school project) where there is an equation that pops up in the top of the screen and then you have to push a ball in a hole with the right answer. My classmates and I don't want to make a thousand levels so we just want to randomize the entire thing. Is there any may I could make it so that the game generates a random equation (that pops up on the screen) with an actual answer to that question?
P.S. I'm no programmer...yet:)javascriptobjectsmathanswerequationWed, 27 Apr 2016 01:12:40 GMTPupManiaSkinned mesh vertex transform equation?
http://answers.unity.com/questions/1031684/skinned-mesh-vertex-transform-equation.html
I am looking for a way to update a transform (empty object) in the same way that a bone-weighted vertex does with the skeleton of a given mesh, effectively attaching the transform to the surface of a skinned mesh. I've got the bones and weights for the object, but I can't find any equation for the positioning and the normal direction. Any help?transformskinned meshequationboneweightsWed, 19 Aug 2015 05:18:16 GMTMaxPower42Making slider match health when values are different.
http://answers.unity.com/questions/1018388/making-slider-match-health-when-values-are-differe.html
HI, this is probably a simple equation but my Math has escaped me today. I problem is I have created a HUD for a survival game through UI filled Images, However the fill area of some of my sliders is not visible. My health and stamina in the game are held in floats and are valued between 0 and 100. however my image fill or slider value is only visible between 0.07 and 0.42. I basically need the slider to move corresponding to the health and stamina floats.
public float playerStamina = 100;
private float maxStamina = 100;
private float minStamina = 0;
public float playerHP = 100;
private float maxHP = 100;
private float minHP = 0;
public Image hpHUD;
public Image staminaHUD;
private float maxSliderValue = 0.42f;
private float minSliderValue = 0.07f;
anyone that can help with equation it would be great. Thanks in advance.mathsliderui imagehealthbarequationThu, 30 Jul 2015 18:20:33 GMTjasonmcevHow to you make a number squared in C#?
http://answers.unity.com/questions/943353/how-to-you-make-a-number-squared-in-c.html
I have looked around to the answer to this question, but i cant seem to find a way. I know i can multiply the number by itself, but that would add a complication that i may not know how to fix with my basic coding knowledge.
I am basicly trying to find the area of a circle and the eqation is πr(squared). I just dont know how to square my math equation. Here is the part of the script where i am doing the math.
(the numbers were entered into inputfield boxes so i had to convert it in the first 3 statements.)
public void Product() {
int a = Convert.ToInt32(t1.text);
int b = Convert.ToInt32(t2.text);
int c = Convert.ToInt32 (t3.text);
int d = a/2*3.14;
Result.text = d.ToString ();
}
}c#mathsquareequationThu, 09 Apr 2015 03:49:27 GMTIan-McClearyOptimising projectile continuously calculated impact point
http://answers.unity.com/questions/880593/optimising-projectile-continuously-calculated-impa.html
Gday all. Apologies for cross post but in hindsight I think this is much better here than the forums.
I am working on a hobby arcadey flight combat game and trying to get CCIP working.
I am not using physics for the projectiles, code in use below:
void Update () {
//Check where the bullet needs to go this frame
bulletSpeed = (bulletTransform.forward * (bulletFireSpeed * Time.deltaTime)) - (Vector3.up * Time.deltaTime * downwardSpeed);
newPosition = transform.position + bulletSpeed;
//raycast to ensure we wont go through terrain or object
if (!Physics.Linecast(bulletTransform.position, newPosition, out ray))
{
bulletTransform.position = newPosition;
}else
{
Impact(ray);
}
downwardSpeed += 5.0f * Time.deltaTime;
}
That all works fine with no issues whatsoever.
The issue is trying to calculate the impact point... My first attempt was just to replicate the bullet code in a function that would step by step simulate a bullet flight path (ie. raycast current loc, loc + speed, if ok then move to new position and repeat, when hit, return hit point as the CCIP reticule loc)
if (!Physics.Linecast(simulatedBullet.position, newPosition, out ray))
{
simulatedBullet.position = newPosition;
}else
{
impactFound = true;
Debug.Log(cycles);
return ray.point;
}
That killed framerate as it generally went through 150-200 cycles before finding the impact point (if it got to 1000 cycles it would exit and hide the reticule)
So attempt 2... instead of linecast (oh yea... expensive!) I decided to use the terrain sample height (as I already have the position of the simulated bullet)
if (simulatedBullet.position.y > Terrain.activeTerrain.SampleHeight(simulatedBullet.position))
{
simulatedBullet.position = newPosition;
}else
{
impactFound = true;
Debug.Log(cycles);
return newPosition;
}
That was slightly better but still devestated frame rate...
The current (quite inadequate) implementation involves using the sampleheight idea above but including a yield time.deltatime every X cycles (I found 10 to be the absolute maximum cycles per frame)
Obviously these ideas are not the way to go... I am assuming I will need to come up with a parabolic equation to simulate the bullet's flight but that will have it's own headaches as far as undulating terrain impact points (and the linecast is the only one that takes into account non terrain objects - eg other planes etc)
So my question is.... Can anyone see an alternate way (that is much nicer on processing power) to calculate it? The 'easy' option I can think of is to tinker with my current 'physics' setup to make the vertical speed constant then I can just do a single linecast from origin to the terrain but that is taking a pretty big hit which I would really prefer not to do... Thoughts?physicsmathbulletequationoptimiseMon, 19 Jan 2015 23:33:49 GMTMickMcreate mesh from equations dynamic
http://answers.unity.com/questions/876599/create-mesh-from-equations-dynamic.html
hi. i have some CAD mathematics equations that lead to draw close shape. how i can make a 3d mesh from it in unity ? it must be completely automatic system .any idea?
![generate][1]
[1]: /storage/temp/38817-unity_answer.jpgmesh3dpolygongenerateequationWed, 14 Jan 2015 17:20:17 GMTmorybestFinding plane perpendicular to an objects velocity
http://answers.unity.com/questions/868893/finding-plane-perpendicular-to-an-objects-velocity.html
I have an object moving at a specific velocity in Vector3, and I can find the velocity through the rigidbody. The thing I'm trying to accomplish is instantiating an object next to the one in question and having it move at the same velocity side-by-side. The only problem is finding out where to instantiate this object. I Don't want it to end up in front of or behind the other object, so I need to find a space perpendicular to the original's direction of motion. I've tried to find a mathematical way of doing this, but I must be missing something because I've come up short of a solution. I was thinking that maybe there was an easy way within Unity, or at least a mathematical solution I could utilize. Any suggestions?vector3velocityequationperpendicularSun, 04 Jan 2015 19:32:16 GMTMasterGalaxyUnity inspector graph for exponential values
http://answers.unity.com/questions/863255/unity-inspector-graph-for-exponential-values.html
For my game I'd like to put my experience system on an exponential graph similar to games like Skyrim and Final Fantasy http://www.uesp.net/wiki/File:Skill_XP_per_Skill_Level_Skyrim.png In Unity there are several built in inspector tools that already perform this functionality for the Shuriken Particle System and Animator. Is it possible to use something like the built in Shuriken inspector graphs to build a simple graph like the one below for a single ability?
![alt text][1]
[1]: /storage/temp/37684-800px-skill_xp_per_skill_level_skyrim.pnginspectorshurikencurvegraphequationSat, 27 Dec 2014 12:37:52 GMTAsh-BlueDocumentation about equation behind Unity physics engine
http://answers.unity.com/questions/823253/documentation-about-equation-behind-unity-physics.html
Hello, I'm quite new with Unity but I need to use it in my Phd project as I need to implement a virtual reality environment. Anyway I need to know everything about laws regulating this environment in order to be precise in the papers I'll write. Therefore I need to find documentation about which Physics engines Unity uses for rigid bodies and documentation about them.I found this about Physx.
https://developer.nvidia.com/sites/default/files/akamai/physx/Index.html
But there is very little about how it is actually implemented i.e. the equation and algorithm behind.
I'm also interested in the numerical methods implemented.
Got any clue on where to find other documentation about it? I actually wasn't able to find any of those info surfing on internet.
Thanks a lot for the help.physicsrigid bodyequationMon, 03 Nov 2014 16:59:40 GMTgabrielemontecchiariSimple equation causing problems.
http://answers.unity.com/questions/747141/simple-equation-causing-problems.html
Basically what I wanted to do was change out my hard variables to flexible ones that would change if one of the base variables were altered. Though, when I do this things are not working properly:
float thrusterTime = GameObject.Find("PlayerShip").GetComponent<ShipPlayerController>().thrusterTime;
float thrusterCooldown = GameObject.Find("PlayerShip").GetComponent<ShipPlayerController>().thrusterCooldown;
float num1 = 0.3f;
float num2 = (0.6f / thrusterCooldown);
float adjuster1 = thrusterTime * num1;
float adjuster2 = thrusterCooldown * num2;
if(cooldownActive == false)
{
gameObject.transform.localScale = new Vector3(adjuster1, 0.5f, 1);
if(thrusterTime <= 0.0f)
{
cooldownActive = true;
}
}
else if (cooldownActive == true)
{
gameObject.transform.localScale = new Vector3(adjuster2, 0.5f, 1);
if(thrusterCooldown <= 0.0f)
{
cooldownActive = false;
}
}
Variable num1 has the hard value of 0.3f, and what happens is that the object is scaling perfectly fine, but as with num2 the object is not scaling at all and I want it so that num1 and num2 will change depending on thrusterTime and thrusterCooldown.bugequationSun, 13 Jul 2014 05:31:36 GMTFatalisFinding the relationship in a list to make an equation.
http://answers.unity.com/questions/665044/finding-the-relationship-in-a-list-to-make-an-equa.html
So I have an equation to form a list of 100 numbers
number[#]=(#*13)%100;
right!!
it looks like this..
1)13
2)26
3)39
4)52
5)65
6)78
7)91
8)4
9)17
10)30
11)43
12)56
13)69
14)82
15)95
16)8
So I need another equation that would give me these numbers
1)77
2)54
3)31
4)8
5)85
6)62
7)39
8)16
9)93
10)70
11)47
12)24
13)1
14)78
15)55
16)32
How would I go about getting an equation for the second list of numbers?
Thanks!listequationSun, 16 Mar 2014 03:04:36 GMTBenjamesCircular motion via the mathematical circle equation?
http://answers.unity.com/questions/596671/circular-rotation-via-the-mathematical-circle-equa.html
I'm looking for a way to create a circular motion for an object. I got the linear and wave (sin) motions working fine. I pretty much know their equations, and they're actual functions (for each point of the graph in x, there's one and only one corresponding point in y - which is the definition of a function) - But the circle isn't a function, since foreach point in the graph, there are two corresponding y values.
From my dusty math knowledge, the equation of the circle is:
x^2 + y^2 = r;
How to get this formula to work in code?
What I have is, an abstract `Movement` class, that other types of movements inherit from, and override the method `GetY` - so `LinearMovement`'s `GetY` just returns the the y value of the velocity, etc. Here's the virtual moving method in the abstract `Movement`
protected virtual void Move()
{
velocity.y = GetY();
cachedTransform.localPosition += (velocity + direction) * Time.deltaTime * speed;
// more unrelated stuff
}
GetY for the sine movement:
protected override float GetY()
{
return Mathf.Sin(2 * Mathf.PI * Time.time * frequency) * wavelength;
}
GetY for the linear movement:
protected override float GetY()
{
return velocity.y;
}
Now, what I tried to do for my circular movement, is return:
sqrt(r - x * x);
But it didn't give me the right movement.
Please don't give answers related to any of the rotation methods (transform.Rotate, transform.RotateAround, etc) - cause that's not the point of this question.
Thanks for any tips.
**EDIT:**
if you're curious where I get `direction` from:
protected virtual void InitDirection()
{
// just get some random orientation for the point/object to face to start moving
float randZ = Random.Range(minInitialOrientation, maxInitialOrientation);
direction = Quaternion.Euler(0, 0, randZ) * cachedTransform.right;
}rotationmathcirclemotionequationSat, 14 Dec 2013 13:42:09 GMTvexeHow do I solve the unknown values in an equation?
http://answers.unity.com/questions/482291/how-do-i-solve-the-unknown-values-in-an-equation.html
Hello people,
I am writing a little and simple fluid statics program to calculate with buoyancy. To calculate that there are a few formulas. And i want the program to give me the unknown values in the equation. E.G. I have this formula which calculates the fluid pressure at a point and the general pressure intensity formula:
void Update () {
#region Formulas
//General Pressure Intensity [ p = F/A ]
Pressure = Force / Area;
//Fluid Pressure at a Point [ p = ρ * g * y ]
Force = (Density * EarthsGravity * Area * DistanceSurfaceToPoint);
#endregion
}
If I give values to the density, gravity, area and the distance(y) The program gives me the force and the pressure. Just like I want it. But when I give the force and the pressure, and the gravity and the density, I don't get the area and the distance(y).
Probably it is quite obvious for the more experienced Unity3D users. But I am stuck. I have googled alot, but without any results.
Sorry for spelling/grammar mistakes, English is not my mother language.
Thanks in advance!c#monodevelopvariablesequationThu, 27 Jun 2013 15:41:33 GMTArrieNeed Equation to flip 5x5 Matrix
http://answers.unity.com/questions/470861/need-equation-to-flip-5x5-matrix.html
On a wing and a prayer here ... does anyone know of a way to flip the values below?
An equation where 2 becomes 14, 3 becomes 13, 4 becomes 12, etc?
![alt text][1]
[1]: /storage/temp/11771-tiletest.jpgmathgridmatrixequationSat, 08 Jun 2013 01:20:50 GMTazmundaiequation game question need help
http://answers.unity.com/questions/468541/equation-game-question-need-help.html
Hi,
I make a simple Unity3D math game script that user must enter correct answer for the math problem given.
This is the script I used.
I just attached this scrip to an Empty game object on a blank scene.
Try this to figure out what I get.
#pragma strict
var a : int; //Define variable a as int
var b : int; //Define variable b as int
var c : int; //Define variable c as int
var stringAnswer : String; //Define the answer as string input
var numAnswer : int; //Define answer in numeric as int
function Start()
{
a = Random.Range(0, 9); //Get random value for a
b = Random.Range(0, 9); //Get random value for b
c = a + b; // c = a + b
}
function OnGUI()
{
GUI.Box(Rect(Screen.width/2 - 200, Screen.height/2 - 5, 400, 40), a + " + " + b + " = "); //Create a box show the equation
stringAnswer = GUI.TextField(Rect(Screen.width/2 + 30, Screen.height/2, 40, 30), stringAnswer, 2); //Create a text field that player input the answer, wether it numeric or text.
numAnswer = int.Parse(stringAnswer); //Convert the string answer to int value
if(numAnswer == c) //Compare the int value of answer with c
{
print("Answer is Correct !!"); //If answer is equal c, tell in terminal that the answer is correct. In future will be a GUI text.
}
else
{
print("Answer is Wrong !!"); //If answer is not equal c, tell in terminal that the answer is wrong. In future will be a GUI text.
}
}
then when I run, I get this error message :
FormatException: Input string was not in the correct format
System.Int32.Parse (System.String s)
test.OnGUI () (at Assets/test.js:20)
That is error in parsing text to integer value.
I use Unity3D v.3.5.5f3 on Windows7 64.
Are there someone could help me correcting this script?
Thank You very much for Your help.mathparseequationgui.textfieldTue, 04 Jun 2013 08:01:48 GMTkonanxiao