# [behavior] rex_LJpotential (attracting or rejecting objects)

### » Tue Jan 12, 2016 4:50 pm

rexrainbow wrote:@Zebbi

I fixed in this capx, see event 9.

Perfect! Thank you so much for your help, I'm trying to get my head around this great sequence of events, but some of the expressions are quite detailed for my poor head! Thanks again!!
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Tue Jan 12, 2016 5:05 pm

justifun wrote:Awesome plugin rex as usual.

Question: In the "crowd" demo for example, sometimes the little boxes wiggle really quickly instead of following a smooth arc. Which of the settings would i need to play with to smooth our their movement? I'm not sure what the parts of the equation mean in relationship to how they move.

thanks

Did you figure out how to take the little jiggle out of the motion? I understand the objects are constantly attracting and rejecting forces, but I'd like to smooth it so the cars aren't shaking as they move, looking a little like they're driving over rough terrain
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Wed Jan 13, 2016 12:51 pm

rexrainbow wrote:@justifun

This behavior only provide a "leading angle", user need to use this angle case by case.
For example, car AI demos use this "leading angle" to simulate turn left/turn right. Crowd or rocket demos use this "leading angle" to rotate the angle.

The parameters A,n,B,m will affect the result of "leading angle".

@rexrainbow would this method help smooth the micro shakes that the cars have? I tried playing with the parameters, but it didn't help.
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Thu Jan 14, 2016 7:20 am

@Zebbi

The car AI is described in event 1~ 6 in your LOOP.capx.
- event 1 : when to update the command of the car
- event 3, 4 : turn left or turn right the car
- event 5, 6 : slow down or speed up the car

You might change these conditions.
( The leading angle is CarF.LJ.ForceAngle )
Goodbye
B
115
S
31
G
295
Posts: 4,549
Reputation: 164,633

### » Thu Jan 14, 2016 2:42 pm

rexrainbow wrote:@Zebbi

The car AI is described in event 1~ 6 in your LOOP.capx.
- event 1 : when to update the command of the car
- event 3, 4 : turn left or turn right the car
- event 5, 6 : slow down or speed up the car

You might change these conditions.
( The leading angle is CarF.LJ.ForceAngle )

@rexrainbow I'm not sure how to still have the car move properly whilst not adjusting left/right in increments, I'm sure if I was good at math I might be able to figure it out, but playing with these figures and it's not helping or changing anything. I'm not really sure what I'm supposed to be doing to be honest, I think I want the left/right steer to update less frequently?
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Thu Jan 14, 2016 5:00 pm

@Zebbi

See my new LOOP.capx :
Add "system condition: Is with in angle" --
CarF.Angle within 3 degrees of CarF.LJ.ForceAngle
before angle checking, you could try to increase (insensitive) the "within" degrees or decrease (more sensitive) it to see the result.
Goodbye
B
115
S
31
G
295
Posts: 4,549
Reputation: 164,633

### » Thu Jan 14, 2016 5:42 pm

rexrainbow wrote:@Zebbi

See my new LOOP.capx :
Add "system condition: Is with in angle" --
CarF.Angle within 3 degrees of CarF.LJ.ForceAngle
before angle checking, you could try to increase (insensitive) the "within" degrees or decrease (more sensitive) it to see the result.

Ahh, I understand that! It looks perfect on your example, have you got magicam? I'm using that plugin to sort out zooms and such, and I'm getting shaking but I can't tell if it's my implementation or not? If you don't, I can try and use scrolling to see if it help the issue: https://www.dropbox.com/s/s5xb1deue5spe ... .capx?dl=0
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Fri Jan 15, 2016 1:44 pm

OMG...this plugin is absolutely *amazing* ... thx soooo much, Rex, this will spare me several headaches.
B
48
S
8
G
1
Posts: 60
Reputation: 2,690

### » Sun Jan 17, 2016 1:41 pm

MassimoF wrote:OMG...this plugin is absolutely *amazing* ... thx soooo much, Rex, this will spare me several headaches.

I think this plugin should be a standard in C2, it's that useful!
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Mon Jan 18, 2016 5:51 am

@Zebbi
@MassimoF

It is not easy even though using this behavior.
- User need adjust the parameters of way-points or blockers , include position, to get a better steer angle for these cars.
- And user need to define a reasonable conditions to drive the car ( AI of the car )

I had not did well in the demo, cars still collided.
Goodbye
B
115
S
31
G
295
Posts: 4,549
Reputation: 164,633

PreviousNext