Big Entity update coming out today. (Please read)


#1

Upcoming in the “New Entities Features” PR - https://github.com/highfidelity/hifi/pull/3402

Good News: Lots of great new features. (see below)

Bad News: Old scenes/models will look funny (stretched) - until they get hand repaired (details below).

New Features:

  • Entities have TRUE dimensions - When you add or edit entities of any type, you now specify their true size and dimensions in world units (meters). This means you can now stretch any entity to an exact dimension. This includes boxes and spheres. So you can now make a wall or a football like shape.
  • Angular Velocity - you can now give entities “angular velocity” and make them spin automatically. This can be combined with linear velocity and animations to make an entity fly across the room while tumbling and animating.
  • Visibility - you can now set a visible true/false property on any entity. This will eventually become more powerful for generating “spaces” or “rooms” that have properties and behaviors but that don’t need to be rendered.
  • Registration Point - previously entities were placed and rotated around their center. Now you can specify a point in the entity (0,0,0 - 1,1,1) at which the entity is “registered to”… With this you can rotate or place entities based on that spot on the model. This allows for easier editing and rotating.
  • Natural Dimensions - Model type entities will have a gettable/non-settable property that indicates their “natural” dimensions as indicated in the FBX file.
  • new UI for “natural dimensions” - The Edit Properties UI now supports a “reset to natural dimensions” button that will read this value and set the dimensions of the entity to that value.

Other fixes:
fixes the crash in butterflies.js
Details on the Bad News:

The old file format didn’t have any concept of how big a model actually was. We only stored a radius of a bounding sphere, and the model would be rendered to fit in that sphere. This isn’t a long term sustainable solution, as we need to allow for models to be stretched or set to arbitrary aspect ratios. Unfortunately, there’s no way for us to know those “natural sizes” in the server for the old file format. So when the server loads an old file, it will “do the best it can” and make the dimensions of the entity be a cube that matches the previous sphere… but this means all models will be stretched and distorted.

These models can be fixed by hand, by using the new “Reset to Natural Size” feature… and then editing the properties accordingly.

Let me know if you have any questions.


#2

Wow, just a week ago we were discussing registration points with Brad, and here we are a week later with that and all the other new goodies too. Thanks @ZappoMan for busting out all this new functionality so fast!


#3

Well the update seems to have gone without isssue


#4

@Chris, can up explain how to create or edit a specific sized box for example to make a floor or wall of a specific size and thickness.

I would like to make a thin (Y small) cylinder with a large X,Z extent that has collision properties to act as a ground terrain floor or sea level, is that now possible?


#5

@Ai_Austin there is currently no collision support. Here is how you can stretch stuff. (this could be done to any type of entity)

  1. make an entity.

  1. Bring up the properties by selecting and pressing ’

  2. scroll down to dimensions and change these to whatever you want.

  1. In my example I am stretching things to be a wall. (units are in meters)

  1. Done. (you could also do this all through scripts)



#6

Great @Chris, thanks. I was able to make various sized floors and walls in tests just now.

I understand a box is not a voxel now.

I was really though wanting to make a hard physics floor to underlie the setup. I am falling through my skydome floor now as its at Y = 0 rather than the previous Y = -6.45 which made it VISUALLY appear just below the real Y = 0 avatar standing base.

Is there a reason objects like skydomes that surround the actual scene cannot have a Y that is negative as was allowed until the recent BIG UI update?


#7

(you could also do this all through scripts)

@Chris, can you remind me of the doc files that document the various API calls and where to find template code examples.


#8

Hi @Ai_Austin docs for entities has not been put together yet, open to people to help or we have it on our list to fill out. Here is an edit model example http://highfidelity-public.s3-us-west-1.amazonaws.com/scripts/editModelExample.js that you could use


#9

When does “server authorization” occur for newly created entities?

Currently, the “Entity Properties” page states:

“It is by design that addEntity() will return an id of {00000000-0000-0000-0000-000000000000} as the client creates the entity locally immediately, and then returns before the server can respond with an official UUID. Default Value: {00000000-0000-0000-0000-000000000000} until the server authorizes creation”

Why is this?

Is entity creation relegated to the client out of expediency? Does this simply make the interaction seem more rapid, or is there another factor? After all, it seems that “authorization” by the server is what matters. (No UUID, no game. See “Observation” below.)

Also, is this necessary? It seems that the UUID is just as likely to be needed at the time of creation as any other time. Is there a circumstance in which knowing the “default” UUID is of use?

Observation: The second and fifth examples in the “Entity Functions” page currently do not produce the expected results. The printed outputs show the default UUIDs being detected, yet the sphere is not deleted or the set of spheres does not change color (see screenshot).


#10

There’s a deeper discussion regarding this in this thread

https://alphas.highfidelity.io/t/why-is-this-identity-script-giveing-uuid-zero-back-as-id/943/14

This was also discussed on Worklist but contains the same information

https://worklist.net/20064


#11

Thank you for the links @Ciaran_Laval. Having read through those discussions, I am still working to understand the “temporary” nature of the entity created by the client.

For example, when I run the following script (build 1274):

var position = Vec3.sum(MyAvatar.position, Quat.getRight(MyAvatar.orientation));  
var properties = {
  type: "Sphere",
  position: position,
  color: {red:100,green:100,blue:200}
};
function deleteSphere() {
 Entities.deleteEntity(Entities.identifyEntity(Ent));
 Script.stop();
}
//create new entity
Ent = Entities.addEntity(properties);
//set timeout for quick deletion
Script.setTimeout(deleteSphere,25.0);

…a blue sphere appears and is quickly deleted (timeout allows brief glimpse), and then another blue sphere appears about five seconds later.

Is this (unexpected) sphere a result of the “server authorization” creating another entity?

Note: Increasing the script’s timeout to >6 seconds results in deletion without the appearance of a new sphere.