New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose HeightfieldColliderShape to use it in Game Studio #561
Expose HeightfieldColliderShape to use it in Game Studio #561
Conversation
…o "Xenko.Physics" 'Xenko.Physics.Shapes.HeightfieldColliderShape' still exists for compatibility.
Deleted HeightfieldSourceHeightmap and IHeightfieldInitialHeights. They are no longer necessary.
I love this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, great PR!
Kudo for the good code, and extra effort to add previews/thumbnails!
Looks good to me. Added a few comments but it's mostly small details.
sources/engine/Xenko.Physics/Shapes/HeightfieldColliderShape.cs
Outdated
Show resolved
Hide resolved
Tried with a heightmap but couldn't get it to work properly (doesn't match the heightmap that you can see in the asset browser): I tried float/short/byte (set to same value on both component collider shape's list and heightmap asset). Also small remark, maybe |
It seems that Heightmap size is not same to HeightStickSize.
Yes, I think so too. |
@EternalTamago Hey, in few days Xenko will be renamed to Stride so it's easier to merge PRs before that. Let me know if you have a working version that can be merged already. |
…o update the cache at rebuilding NavigationMesh. GetStaticColliderCacheSettings and things related to it are no longer used.
… be suitable them. IHeightfieldHeightDescription --> IHeightStickParameters. IInitialHeightfieldHeightData --> IHeightStickArraySource. HeightfieldHeightDataFromHeightmap --> HeightStickArraySourceFromHeightmap. EmptyFloatHeightfieldHeightData --> FloatHeightStickArraySource. EmptyShortHeightfieldHeightData --> ShortHeightStickArraySource. EmptyByteHeightfieldHeightData --> ByteHeightStickArraySource. IHeightfieldHeightScaleCalculator --> IHeightScaleCalculator. HeightfieldHeightScaleCalculator --> HeightScaleCalculator. HeightfieldHeightScaleCalculatorWithValue --> PrecalculatedHeightScaleCalculator.
@xen2 Yes. Sorry for the late reply! |
@xen2 The current state is everything. My words were not enough. Sorry if you are blocked by me. |
@EternalTamago |
@EternalTamago Hi EternalTamago, |
Hi, @Aggror |
Note that we will now just use small videos in the release notes instead of one long video. |
@Aggror @Kryptos-FR |
@xen2 For me, the heightfield collider shape in Game Studio is useful even if there is that issue. I know that it's too late to talk, but I think that we should get clarity on this before the release. |
Updated 2020/03/31
PR Details
Expose HeightfieldColliderShape to use it in Game Studio.
Description
HeightmapAsset
Used to initialize heights of heightfield.
Source
An image file used to generate heightmap from its R channels.
Floating Point Component Range
Determine the range of the floating-point component when the R component is the floating point component.
Is Symmetric Short Component
Determine the range of the signed short integer component when the R component is the signed short integer component.
If enabled, [-32767 .. 32767], otherwise [-32768 .. 32767].
s RGB sampling
Enable if needed to load the image file as sRGB.
Height
Type of height.
Height Range
X is min height and Y is max height. "height * HeightScale" should be in this range. In Byte height type, the range can't include both of positive and negative.
Height Scale
In Short type or in Byte type, "height * HeightScale" is used for collisions in physics. In Float type, heights are used as they are.
Resize
New size of the heightmap. X is width and Y is length. If disabled, the size is same to the image size(width * height). Width and length should be greater than or equal to 2.
Scale To Height Range
If enabled, scale each of the heights to the height range before they are stored as heightmap. By the default, they are considered to be in [-1 .. 1] when the R component is floating-point component format. Edit FloatingPointComponentRange to actual floating point component range(e.g. [0 .. 1]), if needed.
HeightfieldColliderShapeDesc
Used to create HeightfieldColliderShape.
Source
The source to initialize heights.
Heightmap
The heightmap to initialize heights.
Float, Short and Byte
Type of height.
Size
Size of the heightfield. X is width and Y is length. Width and length should be greater than or equal to 2. The Size should be 65 * 65 when you want 64 * 64 size in a scene.
Height Range
X is min height and Y is max height. "height * HeightScale" should be in this range. In Byte height type, the range can't include both of positive and negative.
Height Scale
In Short type or in Byte type, "height * HeightScale" is used for collisions in physics. In Float type, heights are used as they are.
Flip Quad Edges
Change how triangles forming heightfield collider shape are generated.(I'm not sure about this)
Centering
Add offset to ColliderShape.LocalOffset in order to center specific height.
StaticColliderComponent.AlwaysUpdateNaviMeshCache
Enable if you want to update the cache of the collider shape at rebuilding the NavigationMesh.
Use one of the following arrays to update the heights at runtime.
Related Issue
#494
Motivation and Context
Currently there is HeightfieldColliderShape but it can be created only at runtime. It's not available in Game Studio and NavigationMesh.
Types of changes
Checklist