Skip to content
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

Physics #2325

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open

Physics #2325

wants to merge 56 commits into from

Conversation

cNori
Copy link
Contributor

@cNori cNori commented Mar 16, 2024

Fixed joints including scale in calculations

the PxJoint is not expecting to get scaled offset and is collapsing auto anchor if A or B actor is scaled it will snap the joint in to wrong location

added SetTargetAnchor(const Transform& value)

Display Attached Colliders

when selecting rigid body it will show all attached colliders for the rigidbody.
can be enabled or disabled per object using DisplayAttachedColliders
image

Remove thick frame from box collider

when working with small enough collider it hard to set up good collisions for it
as a example
image
this got me on side quest to re doing coliders See: Better colliders

Better colliders

Colliders
image
Triggers
image

  • the colliders now can be displayed with out need to be selected with Display Collider
  • the style is not consistent across all colliders

INFO:
Debug shapes need some more work put in to look better (there is some over draw and weird shading)

Tasks list

  • Colliders no longer are needed to be directly under rb
  • fixed incorent colliders when (A->B...->X) B.. is roteted
  • fix local center of mass is not calculated
  • (optional) fix collider passing through the ground with nested rigidbody when sub rb if IsKinematic is set to true

the PxJoint  is not expecting to get scaled offset and is collapsing auto anchor also if A nd B actor is scaled it will snap the joint in to wrong location

added SetTargetAnchor(const Transform& value)
@mafiesto4 mafiesto4 modified the milestones: 2.0, 1.9 Mar 18, 2024
@cNori cNori changed the title fixed joints including scale in calculations fixed joints including scale in calculations,colliders will no longer need be directly under rigidbody Mar 24, 2024
@cNori
Copy link
Contributor Author

cNori commented May 22, 2024

[to do] after a merge
the CylinderCollider is missing the GJK implementacion for scene querys

Copy link
Member

@Tryibion Tryibion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small spelling mistakes and a couple questions.

Source/Engine/Physics/Actors/RigidBody.h Outdated Show resolved Hide resolved
Source/Engine/Physics/Actors/RigidBody.h Outdated Show resolved Hide resolved
Source/Engine/Physics/Actors/RigidBody.h Outdated Show resolved Hide resolved
Source/Engine/Physics/Colliders/Collider.cpp Outdated Show resolved Hide resolved
Source/Engine/Physics/Colliders/Collider.h Outdated Show resolved Hide resolved
Source/Engine/Physics/Joints/Joint.h Outdated Show resolved Hide resolved
Source/Engine/Physics/Joints/Joint.h Outdated Show resolved Hide resolved
Comment on lines +369 to +374
#ifndef STRING2
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#endif
#pragma message ( __FILE__ "(" STRING(__LINE__) "):" "[Code Mantening] Remove Deprecated code")
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Contributor Author

@cNori cNori May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes there is a code inside the engine which is dedicated and expired
this is reminder to remove it

Comment on lines +987 to +1019
#if 0 // data extractor

String out = String::Format(L"\n static Float3* points [{0}] = ", input.VertexCount);
out.Append('{');
auto data = Array<Float3>(input.VertexData, input.VertexCount);
for (size_t i = 0; i < data.Count(); i++)
{
auto d = data[i];
out.Append(String::Format(L"\tFloat3({0},{1},{2}),\n", d.X, d.Y, d.Z));
}
out.Append(L"};");
if (input.Is16bitIndexData)
{
auto data2 = Array<PxU16>((PxU16*)input.IndexData, input.IndexCount);
for (size_t i = 0; i < data2.Count(); i++)
{
auto d = data2[i];
out.Append(String::Format(L"{0},\n",d));
}
}
else
{
auto data2 = Array<PxU32>((PxU32*)input.IndexData, input.IndexCount);
for (size_t i = 0; i < data2.Count(); i++)
{
auto d = data2[i];
out.Append(String::Format(L"{0},\n", d));
}
}

LOG_STR(Info, out.ToString());
#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is not used? does it need to stay? maybe for debug purposes?

Copy link
Contributor Author

@cNori cNori May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is not used?

yes it is unused

does it need to stay?

idk i used it to extract verts for breaking and just left it there

maybe for debug purposes?

if somfing break it will have use
note is striped from compilation any way

Comment on lines +1 to +25
//template code for Deprecated code at some version
//-----------------------------------------------------------------------------------
// find and replace, legend / info
//-----------------------------------------------------------------------------------
// <depMAJOR> major version (0-...)
// <depMINOR> minor version (0-9)
//-----------------------------------------------------------------------------------
// requerd inclide
//-----------------------------------------------------------------------------------
// FlaxEngine.Gen.h
//-----------------------------------------------------------------------------------


#pragma region Deprecated
#if (FLAXENGINE_VERSION_MAJOR != <depMAJOR> && (FLAXENGINE_VERSION_MINOR >= <depMINOR>))
//<Deprecated code here>

#else
#ifndef STRING2
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#endif
#pragma message ( __FILE__ "(" STRING(__LINE__) "):" "[Code Mantening] Remove Deprecated code")
#endif
#pragma endregion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess Mafi can decide if he wants this.

@cNori cNori requested a review from Tryibion May 24, 2024 21:25
throwed on backlog might be done some day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants