Fakepic February 2016 |OT| Fake Harder

Status
Not open for further replies.
tumblr_o0p9gj0v0o1qd5mq1o1_1280.jpg
 
how the heck do I make c sharp do this:

r^2=(x-k)^2+((k-j)/(i-r))^2(x-i)^2 solve for x

(where all other variables are already created)
 
Write fuck off, throw the computer from the second floor or the house roof and forget what you were trying to do
that's what i'm leaning toward
What formula is that? There's probably a simpler way to re-arrange it whatever you're doing, but if not then Wolfram Alpha has you covered:

http://www.wolframalpha.com/input/?...^2(x-i)^2&rawformassumption="i"+->+"Variable"

MSP38981c08g0298c8dh5d500002383h968dc3g9g60

its a series of equations set up so I could solve for a single ordered pair (slope, midpoint, circle, slope intercept)
http://i.imgur.com/jF6ggv6.png

yeah I already used wolfram alpha and that doesn't help much for that at least

I probably could just not use the bottom two things since they're just most of the others combined but I'm going to have to use the circle formula which still makes it difficult for c sharp
 
Assuming there isn't a typo it doesn't get a lot simpler with X both being in an exponent and not. There may rbe some identities to swap in, bit otherwise it stays messy.

PS: added you on XBL the other day

Right. I just didn't know if she was trying to calculate something useful or if it's an abstract math problem. In essence, I'm wondering where she got the formula from. Usually when I copy formulae for different purposes there's example code available to demonstrate a reasonable implementation.

oh, and I just accepted your friend request. I think. The UI for this confuses me a little bit, but whatever.
 
http://i.imgur.com/jF6ggv6.png

yeah I already used wolfram alpha and that doesn't help much for that at least

Oh. So there is a typo in your original post-- X doesn't end up in an exponent in that image.

Right. I just didn't know if she was trying to calculate something useful or if it's an abstract math problem.

Well, me either. If the other variables are known, as they seem to be, solving for X is determining a value; from the initial question I thought she was looking for an answer of the form X = f(mess of other variables).

oh, and I just accepted your friend request. I think. The UI for this confuses me a little bit, but whatever.

It is peculiar-- with the One, it's like Twitter: you don't send/accept friend requests-- you just follow people and can see all the things they post, and if they follow you too then you're 'friends'. It was the more traditional method on the 360.

Since I only use it for multiplayer and comparing scores I only don't follow people back if I am oblivious or I really have no idea who they are or where they're from.
 
Oh. So there is a typo in your original post-- X doesn't end up in an exponent in that image.
Yeah I realized after a bit
Well, me either. If the other variables are known, as they seem to be, solving for X is determining a value; from the initial question I thought she was looking for an answer of the form X = f(mess of other variables).
I mean they aren't known at the time of coding. It would be like:

public float radius; //at top. variable that determines how far camera is from player

float xPlayer= player.transform.position.x;//in function
etc
and then
float x= [insert equation solving for x here];
float z = [insert equation solving for z here];
transform.position.Set(x, transform.position.y, z);//or whatever it would be

(y in the formulas should really be z but i'm used to y when on a 2d grid)
 
It would be like:

public float radius; //at top. variable that determines how far camera is from player

float xPlayer= player.transform.position.x;//in function
etc
and then
float x= [insert equation solving for x here];
float z = [insert equation solving for z here];
transform.position.Set(x, transform.position.y, z);//or whatever it would be

(y in the formulas should really be z but i'm used to y when on a 2d grid)

So, from the sketch, the player has come from (Xi, Yi) and is at (Xo, Yo) and you want to park the camera at the (unlabeled) midpoint (X, Y) that is R distance from (Xo, Yo)? (where 'i' is 'subscript 1' and 'o' is 'subscript 0').


apparently the solution is I have to use trigonometry.

Yes, but not that difficult I think, if my supposition is correct.
 
So, from the sketch, the player has come from (Xi, Yi) and is at (Xo, Yo) and you want to park the camera at the (unlabeled) midpoint (X, Y) that is R distance from (Xo, Yo)? (where 'i' is 'subscript 1' and 'o' is 'subscript 0').

Yes, but not that difficult I think, if my supposition is correct.
basically but not midpoint. it should be outside the player so It can focus on the target while still being behind the player.
midpoint actually would have been really easy since unity has some functions for that but I couldn't find one for outside.

this is what I'm aiming for eventually: http://i.imgur.com/gTPyP42.png
(top two are top down and bottom two are camera's view)
basically the idea is for when its locked on for it to always face the target while still keeping the player in the forefront of the screen and keeping as much of the screen open for where the player is moving toward. pretty standard


edit: @mathhaters I was going to keep it just to complaining but people actually responded :P
 
basically but not midpoint. it should be outside the player so It can focus on the target while still being behind the player.

... I think you've lost me, but based on everything maybe this will do?

This is obviously not C#, but:
Code:
function (Radius, (Xi, Zi), (Xo,Zo)) {
    theta = arccos(Xo/(sqrt((Xi - Xo)^2 + (Zi - Zo)^2));
    X = Radius * cos(theta);
    Z = Radius * sin(theta);
}

Can remove trig calls by:

Code:
function (Radius, (Xi, Zi), (Xo,Zo)) {
    X = Radius * (Xo/(sqrt((Xi - Xo)^2 + (Zi - Zo)^2))
    Z = Radius * (Zo/(sqrt((Xi - Xo)^2 + (Zi - Zo)^2))
}

You may want to make sure that this (X,Z) is where you expect it since you're only going to get the positive roots, so (-X, -Z) might be correct.
 
... I think you've lost me, but based on everything maybe this will do?

You may want to make sure that this (X,Z) is where you expect it since you're only going to get the positive roots, so (-X, -Z) might be correct.
that looks right. will take awhile to think about it since I've always hated angles and trig

and to clarify
http://i.imgur.com/OG7P4jf.png
camera is pink point, player is blue point, target is green point. player will always be between camera and target
 
http://i.imgur.com/OG7P4jf.png
camera is pink point, player is blue point, target is green point. player will always be between camera and target

Code:
function foo(Radius, (Xi, Zi), (Xo,Zo)) {
        PlayerTargetDistance = sqrt((Xi - Xo)^2 + (Zi - Zo)^2);
        if ((Xi - Xo) > 0) {
            X = Xi - Radius * Xo/PlayerTargetDistance;
        } else {
            X = Xi + Radius * Xo/PlayerTargetDistance;
        } 
        if ((Zi - Zo) > 0) {
            Z = Zi - Radius * Zo/PlayerTargetDistance;
        } else {
            Z = Zi + Radius * Zo/PlayerTargetDistance;
        }
        return (X, Z);
}
 
alright thanks. now to spend 2 hours figuring out how to apply it (and then realizing the only reason it didn't take me 5 minutes is a typo)
 
Everyone is making video games, I will too. Will start learning how to code tomorrow on February 30th.
 
yup that's exactly it. similarish to zelda

Code:
transform.LookAt(target);
on the camera GameObject will cause the camera to follow whatever GO you are targeting.

if that's what you're going for.
 
Status
Not open for further replies.
Top Bottom