Setting physics drag property directly vs from variable

Hi everyone,

Can someone help me understand the subtleties of assigning a value to the drag property? I noticed that assigning with the slider in the Physics tab and assigning using a variable produces different results for the same numerical value.

Here’s my demo: https://ready.app.link/AC5Pd39bb2

For the sprite on the left (Arthur Brown), the drag property value is assigned via the slider in the Physics tab. For the sprite on the right (Arthur White), the default setting is overridden in an event where a variable value is assigned. In both cases, the numerical value is 0.28, yet the brown sprite jumps higher than the white one. Can someone help me understand why this is i.e. what is the relationship between the values in the slider and the values in a variable, with respect to the physics drag property?

Thanks!

4 Likes

I looked at Arthur White appearance tab and can’t see the collision mask option.
Arthur Brown has the mask set as Box.

That’s weird as well.

Is one of the Arthur’s a copy of an original?
And not a separate sprite you dragged from the library?

The copy might have attributes of the original.
So the copy might have a variable drag added to the set bar drag.

4 Likes

They have different braking parameters (Drag), there is nothing surprising when the white Arthur slows down with more force.

3 Likes

Thanks for the replies, guys! :slight_smile:

@Suzzy-Grey, your suspicion is correct - Arthur White is a copy. (I had been experimenting with Arthur Brown, then to make a demo to show the variants side-by-side for the forum, I copied the original.) I’ve noticed that in the new version of Ready, copies have only a subset of the properties in the Appearance tab.

You make a good point about side effects related to copies, so I made a new demo. In this one, each sprite is dragged fresh from the library. The one on the left (“Arthur”, green) has drag set to 0.58% in the physics tab. The one on the right (“Arthur 2”, red) retains the default drag of 0% in the physics tab, but is assigned drag value 0.58 from variable “drag-arthur” in the event. The results are qualitatively identical to demo v01 (in v01 I used drag value 0.28, in v02 I used drag value 0.58. The reason is that the drag slider is inordinately difficult to use for non-integer values and I was unable to set it to 0.28.)

So to recap my question: if I want to control the physics drag property using a variable, what value do I set the variable to to achieve the same drag force as when the drag slider is set to 0.28 (or 0.58, or any other value)?

@Ready, yes they have different braking parameters in the Physics tab, but the white one has its drag value changed in the event. In both cases (physics tab slider and variable used in the event), the numerical value is 0.28, but the results are different. I’m trying to understand the relationship between the two.

Here’s the new demo: https://ready.app.link/1EIRElmAc2

3 Likes

When i made the 3d look around room gif, i had to code when variable for frame exceeds 100, set the variable to 0.
The gif didn’t have 100 frames.
100 means 100%
So the slider bar percentage and the variable number you use could mean 2 different things.

3 Likes

I’m sure they do mean different things. I’m trying to find out how to convert between them.

3 Likes

You can code so when an arrow key is tapped, the variable for drag adds 1.
Keep tapping the arrow until both Arthurs bounce the same height.
Then compare slider and variable value differences and get an a average difference in percentage.
That’s the easiest way with the limitations of not having precise X,Y position data

When Drag is coded 1% it changes when viewed.
When slider bar is 1% it changes when viewed again.

From the results i achieved, it seems the slider bar Drag has to be aprox 60% greater in value to a Drags coded variable to get the same results

3 Likes

Thanks for that suggestion, @Suzzy-Grey, and thanks for the results report! I was hoping the Ready team would be able to share with us the actual definitions they use, but a good estimate is very useful! :+1:

3 Likes

Hi Guys! Yes, for some reason, numerical values display a slightly different result in events. I think now we can also use a global variable. For example:

  • Create a “Drag Value” global variable and add new value to it

  • Create a new event:

      System/Runtime/Every Frame
    
      Arthur1/Physics/Set Drag/"Drag Value"
      Arthur2/Physics/Set Drag/"Drag Value"
    

You can always add another diferent value to the global variable when game playing.

3 Likes

Thanks for the reply, @Ready!. In the demos I posted, one sprite’s drag is governed by the slider in the physics tab and the other sprite’s drag is governed by a global variable plus event (same as in your post). But the same numerical value for the slider and the variable produce very different simulated drag forces. I was hoping to learn about the underlying reasons for the difference, or at least how to convert between them. @Suzzy-Grey’s experiment has shed some light on the latter.

A related topic is how I came to notice the discrepancy: Arthur bounces nicely when the physics tab slider is set to 0.28% but adjusting the slider to a specific non-integer value is pretty much impossible. I achieved the 0.28% value by “accident” but I was never able to get anywhere close to that on subsequent tries. This is what led me to attempt to govern the drag via a variable+event, which is when I noticed that setting the variable to 0.28 still didn’t give me the bounce height I was trying for. Summary: it would be helpful to have a text field in addition to the slider (as in the Dimensions settings and elsewhere).

3 Likes

Yes, I think we should pay attention to this in the future! Thanks :+1:

3 Likes