Box2d .settings

many guides used UserData.But only I don’t see the setUserData functions as in them. After understanding it, I realized that these manuals were outdated, and now there is no such function and userData should be set in a different way. After digging through the Box2d files for three days, I realized that I could not cope alone. I found out that it is possible to edit the b2fixtureDef structure to add my new data there. but I don’t understand how to do this correctly, because just adding a line to the structure of the program crashes

How to teleport a kinematic Rigidbody2D with the interpolation settings on?

I would like to start by quoting some parts of the documentation. The first thing that catches my eye is the difference in the description of the MovePosition methods of Rigidbody and Rigidbody2D components.

Rigidbody.MovePosition

Moves the kinematic Rigidbody towards position.

Rigidbody.MovePosition moves a Rigidbody and complies with the interpolation settings. When Rigidbody interpolation is enabled, Rigidbody.MovePosition creates a smooth transition between frames. Unity moves a Rigidbody in each FixedUpdate call. The position occurs in world space. Teleporting a Rigidbody from one position to another uses Rigidbody.position instead of MovePosition.

Rigidbody2D.MovePosition

Moves the rigidbody to position.

Moves the rigidbody to the specified position by calculating the appropriate linear velocity required to move the rigidbody to that position during the next physics update. During the move, neither gravity or linear drag will affect the body. This causes the object to rapidly move from the existing position, through the world, to the specified position.

Because this feature allows a rigidbody to be moved rapidly to the specified position through the world, any colliders attached to the rigidbody will react as expected i.e. they will produce collisions and/or triggers. This also means that if the colliders produce a collision then it will affect the rigidbody movement and potentially stop it from reaching the specified position during the next physics update. If the rigidbody is kinematic then any collisions won’t affect the rigidbody itself and will only affect any other dynamic colliders.

2D rigidbodies have a fixed limit on how fast they can move therefore attempting to move large distances over short time-scales can result in the rigidbody not reaching the specified position during the next physics update. It is recommended that you use this for relatively small distance movements only.

It is important to understand that the actual position change will only occur during the next physics update therefore calling this method repeatedly without waiting for the next physics update will result in the last call being used. For this reason, it is recommended that it is called during the FixedUpdate callback.

Note: MovePosition is intended for use with kinematic rigidbodies.

The description of Rigidbody2D.MovePosition seems to be more detailed but then the question arises whether the differences in the descriptions mutually applicable (to both types of rigidbodies)?

For example, the Rigidbody.MovePosition description sounds like it moves only a kinematic rigidbody. It also explicitly states that MovePosition complies with the interpolation settings and position should be used for teleportation needs.

The last sentence looks like an exact answer to my question if all this were true. But at least this is not the case for Rigidbody2D: my experiments have shown that both: Rigidbody2D.MovePosition and Rigidbody2D.position complies with interpolation settings.

The first part of this video demonstrates the movement of 2 Rigidbody2D kinematic objects with interpolation via MovePosition & position. Then I turn off interpolation and play the same scene. Time is set to 0.01, so you can easily observe that interpolation works in the first part and does not in the second. Also in the first part you can notice that changing Rigidbody2D.position with interpolation settings on really teleports the object (as documentation claims) but only in the first FixedUpdate, then it is interpolated along with Rigidbody2D.MovePosition.

So, my questions are (still the main one is the 3rd):

  1. Is the differences in the descriptions mutually applicable (to both types of rigidbodies)?
  2. Why does Rigidbody2D.position interpolate the object after the first FixedUpdate while it shouldn’t?
  3. What is the correct way to teleport the kinematic Rigidbody2D with the interpolation settings on?

The only way I could come up with is turning interpolation off & on:

Rigidbody2D rb = player.GetComponent<Rigidbody2D>(); RigidbodyInterpolation2D interpolation = rb.interpolation; rb.interpolation = RigidbodyInterpolation2D.Interpolate; rb.position += (Vector2)shift; rb.interpolation = interpolation; 

db schema for storing multiple choices user settings

I am working on a project with the following data structure :

datamodel

A user need to be able to perform personal filtering on a given project, and this filtering needs to be saved (for each user/project pair). For example, he can choose to filter based on attribute1, attribute 2.

For storing such user settings, I did use this schema:

enter image description here

and I can have for example a setting for attribute1 filtering, and in my user_setting table store the corresponding value.

My problem is that the user needs to be able to perform a manual filtering on the objects (i.e. filtering them with checkbox). That would result in choosing objectIDs among all the object IDs.

My first thought was to store them in setting_value as comma separated values, but I read that I should not denormalize (note that there can be a lot of objects, and a lot of projects).

Is it a good approach or should I rethink my user setting storage approach?

WooCommerce settings API set checkbox checked by default [closed]

Using WooCommerce settings API to create some options on its settings page: https://docs.woocommerce.com/document/adding-a-section-to-a-settings-tab/

Everything works fine but unfortunately, I can’t seem to get checkboxes to be checked by default (before admin actually saves changes…aka on fresh install)

I know I can create the option in the DB on plugin install but I’m trying to just get the checkbox checked by default without creating options on plugin activation.

I’ve tried multiple options

            'name'     => __( 'Field Name', 'lpac' ),             'desc'     => __( 'Field description', 'lpac' ),             'id'       => 'field_id',             'type'     => 'checkbox',             'default' => true, // doesn't work             'css'      => 'min-width:300px;',         ); 

I’ve tried setting the default to different values like ‘checked’ and ‘on’ but still, the checkbox is not checked by default

Plugin to manage user permissions that saves settings to file instead of database [closed]

I want to manage user roles and permissions/capabilities through a plugin. Most plugins save their settings to the database. Since we’re running multiple environments with seperate databases, saving to the database is inconvenient. After every deploy we’d have to update the settings on the other environment.

What I’m looking for is a plugin which persists its settings to a file, much like ACF does with the acf-json folder. This way I don’t have to remember to update the settings after every deploy. Is there any plugin which does this?

I’m aware there are plugins with manual backup/restore functionality. While this does alleviate the problem, it’s not the solution I’m looking for

DNS Settings and the TXT record for authorizing email sending from the domain

Last night, I added a DNS record to my domain to allow Mailchimp to send emails as an official/authorized source.

enter image description here

It doesn’t seem to have totally worked, Mailchimp is sending emails but they are not being received – I believe this is because my SPF record is not properly authorizing Mailchimp’s servers to send on behalf of my domain.

I did a domain check at mxtoolbox and it’s showing "Multiple SPF Records Found":

enter image description here

Is it the ~all and -all that is causing an issue? It should be possible to have multiple TXT DNS records, right? Am I messing up the way I have added these TXT records?

I’d like to continue to be able to send email via Google/Gmail (this is working) but I also would like to authorize Mailchimp to send emails on behalf of my domain (hosted with GoDaddy)

Any suggestions for the setup I am trying to accomplish here? Thank you so much!

Remove “Default” from Gutenberg typography settings

I’ve added my own font sizes to the theme I’m working on, but the value "Default" persists in the dropdown. With the name scheme needed for this particular site I cannot just reformat "Default" to fit with my baseline typography. Can "Default" be removed somehow?

enter image description here

Code:

add_theme_support( 'editor-font-sizes', array(     array(         'name' => esc_attr__( 'Book 16px', 'wav' ),         'size' => 16,         'slug' => 'book16px'     ),     array(         'name' => esc_attr__( 'Book 20px', 'wav' ),         'size' => 20,         'slug' => 'book20px'     ),     array(         'name' => esc_attr__( 'Book 24px', 'wav' ),         'size' => 24,         'slug' => 'book24px'     ),     array(         'name' => esc_attr__( 'Book 32px', 'wav' ),         'size' => 32,         'slug' => 'book32px'     ),     array(         'name' => esc_attr__( 'Book 36px', 'wav' ),         'size' => 36,         'slug' => 'book36px'     ),     array(         'name' => esc_attr__( 'Book 48px', 'wav' ),         'size' => 48,         'slug' => 'book48px'     ),     array(         'name' => esc_attr__( 'Book 64px', 'wav' ),         'size' => 64,         'slug' => 'book64px'     ),     array(         'name' => esc_attr__( 'Book 96px', 'wav' ),         'size' => 96,         'slug' => 'book96px'     ),     array(         'name' => esc_attr__( 'Book 144px', 'wav' ),         'size' => 144,         'slug' => 'book144px'     ), ));