[behavior] rex_LJpotential (attracting or rejecting objects)

0 favourites
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • The environment i intend to create is exactly what u are showing in your ai for racecars demo 2.

    That specific capx u already have would be great to have as a basis for a racing game.

    All sample capx files are included in document link, feel free to use them.

  • Thats great Rexrainbow!

    Thank u very much.

  • 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

  • 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 - Can you explain how adjusting those parameters will change how the objects react?

    I understand "attracting/detracting magnitute - the strength that the objects gets pulled towards or away from the source object, but what does Attracting/Detracting Declined mean?

    thx

  • The foumla of this behavior is

    (A/(r^n)) - (B/(r^m))

    For example, n=1 , m=2

    A/r - B/(r*r)

  • rexrainbow

    I'm not very good at math, so i was trying to figure out how changing those values affect how the objects move.

    for example:

    It appears that increasing "A" makes the objects attract stronger to one another

    what does "n" and "m" do?

  • The bigger n, the attracting will get smaller at the same distance.

  • rexrainbow

    Useful stuff as usual. Right now I'm trying to figure out one thing:

    • There are two types of units: enemy units and player's units
    • Enemy units are attracted to the players units and the other way around (this part is working)
    • But at the same time player's units should reject other player units and the same for enemy - I can't figure out how to do it

    If I change "B" from 0 to some higher value, they start to reject opponent's units. Right now I'm using Source/Target Tags for differentiation. I think the problem is that the units of the same type do not consider other units of the same type as source, and that's why rejection doesn't work. I'm gonna try to use groups for differentiation.

  • xoros

    Yes, tag system in this behavior has limitation. That's way I add instance group supporting (calculation manually) for advance. Moreover, user could rest A,B,n,m before calculation.

  • I tried to set Attraction Parameters on runtime - but there's no possibility to set a number: "SetLJpotential LJ parameter" - only a pulldown menu with parameter

  • xoros

    Thanks for finding this bug. I had updated this behavior to fix it, please download it again.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Cool

  • rexrainbow

    Hmm, still can't figure out how to reject the same unit type and attract to the opposite units. Basically it's like magnets: blues reject blues but attract reds, and reds reject reds but attract blues.

    What I'm doing right now:

    • unit on created > add to the "reject&type" group, add to the "attract&type" group
    • for each unit > clean force; pick "reject&type" group; set LJ potential B to 10; Attracted by source Units; set angle to force

    > pick "attract&type" group; set LJ potential A to 10; Attracted by source Units; set angle to force

    Please, halp

  • xoros

    I am not sure, will you provide a sample capx? It is also an interesting demo I guess.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)