# Algorithm What is the mathematical explanation behind this implementation of simulating eyeballs roll in eyes?

## Recommended Posts

I want to simulate eyeballs roll in eyes and I have found and forked this implementation in codepen.io. This is exactly what I need.

Smart way but I don't understand why it needs to work like this way. Why is it using ratioX and ratioY which are calculated from dividing mouseX and mouseY with their sum?  Is there a simpler or even cleverer way to do similar simulation?

Edited by caymanbruce

##### Share on other sites

I think they are using the x/y ratio as a cheap way to do fake trigonometry. If the mouse is far away from the eyes, they should rotate slower. If the mouse is close to the eyes, it will rotate faster. That would happen naturally with sin/cos. So I think what they have is already pretty simple and clever.

Edited by missionctrl

## Create an account

Register a new account

• 12
• 10
• 11
• 18
• 13
• ### Similar Content

• By Descent
Wow what a wild game by GalaXa Games Entertainment Interactive. Play now... it's really fun but IF you have epilepsy then don't play. It does not feature flashing pictures, but there is lots of animated stuff that might get ya. Anyway, 4 levels, 2 endings, insane action, BY INFERNAL. Please play it, right nao! Also , nice midi music composed by me is in the game.

demons.rar
• By Stewie.G
Hi,

I've been trying to implement a basic gaussian blur using the gaussian formula, and here is what it looks like so far:
float gaussian(float x, float sigma)
{
float pi = 3.14159;
float sigma_square = sigma * sigma;
float a = 1 / sqrt(2 * pi*sigma_square);
float b = exp(-((x*x) / (2 * sigma_square)));
return a * b;
}
My problem is that I don't quite know what sigma should be.
It seems that if I provide a random value for sigma, weights in my kernel won't add up to 1.
So I ended up calling my gaussian function with sigma == 1, which gives me weights adding up to 1, but also a very subtle blur.
Here is what my kernel looks like with sigma == 1
[0]    0.0033238872995488885
[1]    0.023804742479357766
[2]    0.09713820127276819
[3]    0.22585307043511713
[4]    0.29920669915475656
[5]    0.22585307043511713
[6]    0.09713820127276819
[7]    0.023804742479357766
[8]    0.0033238872995488885

I would have liked it to be more "rounded" at the top, or a better spread instead of wasting [0], [1], [2] with values bellow 0.1.
Based on my experiments, the key to this is to provide a different sigma, but if I do, my kernel values no longer adds up to 1, which results to a darker blur.
I've found this post
... which helped me a bit, but I am really confused with this the part where he divide sigma by 3.
Can someone please explain how sigma works? How is it related to my kernel size, how can I balance my weights with different sigmas, ect...

Thanks :-)

• Hi all. I have been looking for a real-time global illumination algorithm to use in my game. I've found voxel cone tracing and I'm debating whether or not it's an algorithm worth investing my time researching and implementing. I have this doubt due to the following reasons:
. I see a lot of people say it's really hard to implement.
. Apparently this algorithm requires some Nvidia extension to work efficiently according to the original paper (I highly doubt it though)
. Barely real-time performance, meaning it's too slow to be implemented in a game

So in order to determine if I should invest time in voxel cone tracing, I want to ask the following questions:
. Is the algorithm itself flexible enough so that I can increase the performance by tweaking it (probably lowering the GI quality at the same time, but I don't care)
. Can I implement it without any driver requirement or special extensions, like the paper claims?

• I understand what stationary OBB intersection test is get min/max scalar in 15 axises, when all overlap, then minimum interval overlapping is the axis that used to push away 2 OBBs to "just touch". I have complete this.
So in sweep test, how to choose the right axis projecting and how every projection transform? I only need a ratio of current velocity when start intersect from disjoint.
I have read Ron Levine's post:
http://www.realtimecollisiondetection.net/files/levine_swept_sat.txt

And oliii's:
I get the code but cannot get it works as expect when port to my project, even I don't clearly know what params refer to.

For further optimization, I wish somebody can teach me how velocity part works conceptually instead of just code.
My case is DOBB-OBB only(dynamic to stationary).

• I am developing a cross platform game for which I needs to generate unique identifier (User ID) for each user. I known some platform (Android or iOS) specific approaches to get device related identifiers but I am looking for a solution independent of the device identifiers.
User ID Requirements:
1. Independent of the device's platform
2. Offline implementation (no communication with any servers)
3. Without sign-up process
I have implemented one approach to create User IDs where I store the system time when the game was launched for the first time on the device.
I have following questions:
1. Are there any other approaches to generate User IDs (which will meet the above requirements)?
2. What are the common approaches to create unique identifiers with taking any information from the user?
3. Are there any third party plug-ins to implement User IDs?
I would appreciate any suggestions and thoughts on this topic.
EDIT:
There are lot of responses to use UUID/GUID. Generally, this approach looks fine but I am looking for a solution which can generate same User ID even if the user reinstall the game.