# Kramuals explained

## Kramuals explained

So over at the livestream we had a discussion on why kramuals are possible, and why diagonal kramuals aren't, and to so explain this, here I am with the explanation.

So first up, the snippet of code that makes it work:

This code here (and variation of others) exist in bosh's "skeleton" physics. These "skeleton" connections are what makes bosh sit upright, and return back to "normal" position after being left alone for a certain amount of time. For a visual representation, you can turn on contact points with my builds, or use 6.1 contact points to view every skeletal connection bosh has.

What this function does is basically check the distance between each contact point and tries to move him back to the default distance, not position, distance.

What each thing means:

a.x/a.y = is one contact point's coordinates, b.x/b.y = second contact point's coordinates. Everything else isn't as significant.

Now here's how a kramual occurs. Look at these two lines:

This is the initial step for checking the distance between the two points. If the math behing var _loc3 or var _loc2 result in zero, a kramual may occur. Now, assuming that only one of these results in 0, I shal shift your attention to the second part of this code:

Notice how it's asking for _loc3 or _loc2 to be

And finally, the third snippet of code:

Notice how it's trying to add _loc4 and _loc5 to the XY positions of the points? Well, what happens if you add 0 to the coordinate? It doesn't move. And if every point ends up sharing the X or Y coordinate, kramual happens. This doesn't mean that bosh stops moving, we all know you can keep bosh moving in any direction in a kramual. What it means is that the points won't stop sharing the same coordinates, IE that kramual lock we get. Hence why kramuals tend to crash only if rotated, or can only be broken from with a specific well, most commonly the shoulder, because you're forcing a change in the points position.

So why aren't diagonal kramuals possible? Simple. The X or Y points have to

So first up, the snippet of code that makes it work:

- Code:
`function satisfyDistance()`

{

var _loc3 = a.x - b.x;

var _loc2 = a.y - b.y;

var _loc7 = Math.sqrt(_loc3 * _loc3 + _loc2 * _loc2);

var _loc6 = (_loc7 - restLength) / _loc7 * 5.000000E-001;

var _loc5 = _loc3 * _loc6;

var _loc4 = _loc2 * _loc6;

a.x = a.x - _loc5;

a.y = a.y - _loc4;

b.x = b.x + _loc5;

b.y = b.y + _loc4;

} // End of the function

This code here (and variation of others) exist in bosh's "skeleton" physics. These "skeleton" connections are what makes bosh sit upright, and return back to "normal" position after being left alone for a certain amount of time. For a visual representation, you can turn on contact points with my builds, or use 6.1 contact points to view every skeletal connection bosh has.

What this function does is basically check the distance between each contact point and tries to move him back to the default distance, not position, distance.

What each thing means:

a.x/a.y = is one contact point's coordinates, b.x/b.y = second contact point's coordinates. Everything else isn't as significant.

Now here's how a kramual occurs. Look at these two lines:

- Code:
`var _loc3 = a.x - b.x;`

var _loc2 = a.y - b.y;

This is the initial step for checking the distance between the two points. If the math behing var _loc3 or var _loc2 result in zero, a kramual may occur. Now, assuming that only one of these results in 0, I shal shift your attention to the second part of this code:

- Code:
`var _loc5 = _loc3 * _loc6;`

var _loc4 = _loc2 * _loc6;

Notice how it's asking for _loc3 or _loc2 to be

**MULTIPLIED**by whatever _loc6 is? Don't worry about whatever _loc6 is, we all know anything multiplied by zero, equals 0. So if _loc3 is 0, _loc5 is 0. And if _loc2 is 0, _loc4 is 0. No questions asked.And finally, the third snippet of code:

- Code:
`a.x = a.x - _loc5;`

a.y = a.y - _loc4;

b.x = b.x + _loc5;

b.y = b.y + _loc4;

Notice how it's trying to add _loc4 and _loc5 to the XY positions of the points? Well, what happens if you add 0 to the coordinate? It doesn't move. And if every point ends up sharing the X or Y coordinate, kramual happens. This doesn't mean that bosh stops moving, we all know you can keep bosh moving in any direction in a kramual. What it means is that the points won't stop sharing the same coordinates, IE that kramual lock we get. Hence why kramuals tend to crash only if rotated, or can only be broken from with a specific well, most commonly the shoulder, because you're forcing a change in the points position.

So why aren't diagonal kramuals possible? Simple. The X or Y points have to

**IDENTICAL**, diagonal lines by default do not share X or Y positions anywhere on the line. The resulting math doesn't cause _loc2 or _loc3 to result in 0, and therefore the skeleton will be able to adjust the points as needed._________________

LR Subreddit http://www.reddit.com/r/linerider/

Discord Group https://discord.gg/0ggPNq98iruWoixw

OpenLR https://github.com/kevansevans/openLR

My Tracks https://www.youtube.com/playlist?list=PLLLsxGACxkK8PYsamGoFkDABMHxahqF1G

**[senpai] kevans**- Member
- Stay in your coma

## Re: Kramuals explained

Not sure I toooootally understood that but I think I see why you say that diagonal kramuals are impossible now.

_________________

**Support My Art**

**A playlist of my best tracks**

*To keep up with what I'm up to in the world of Line Rider, follow me:*

**My Twitter**|

**My Tumblr**|

**My Twitch**|

**My Facebook Page**|

**My Instagram**

(You can also follow my patreon and see all public posts completely for free)

**rabid squirrel**- Member
- I'm the artsy guy round here

Page

**1**of**1****Permissions in this forum:**

**cannot**reply to topics in this forum

Tue Mar 20, 2018 3:52 pm by Min3rl3g4nd

» Just another new fan here

Mon Mar 19, 2018 9:08 am by

Sheldon» openLR project thread

Mon Mar 19, 2018 2:37 am by [senpai] kevans

» the 2nd interrobang (finished version)

Sat Mar 17, 2018 10:52 pm by Min3rl3g4nd

» new collab? 2nd Interrobang?

Sat Mar 17, 2018 9:36 pm by Min3rl3g4nd

» [Track Jam 2] Aerial Concept

Sat Mar 10, 2018 2:49 pm by VailxD

» :D [Ride Liner]

Sat Mar 10, 2018 2:45 pm by VailxD

» Invincible

Sat Mar 10, 2018 12:16 pm by Min3rl3g4nd

» Polargeist (not a synced track)

Wed Mar 07, 2018 7:16 pm by Min3rl3g4nd