Some issues to make a breakout with C#.

#1
When I made a breakout with C#, I faced some issues.

1. After I destroyed some blocks by Entity.Remove(),
when I switch to game again,
editor will crash.
Is there any attention point to use Entity.Remove()?

2. Can I specify Mesh or Rigidbody in Entity.GetComponent<>()?

3. How to disable gravity of Rigidbody?

4. How to freeze position or rotation of Rigidbody?

5. How to add physic material component ?

Thank you.

Re: Some issues to make a breakout with C#.

#2
Hey toyashiwasu,

1. We are aware of issues with the Entity.Remove method and recommend using Entity.Hide for now.
2. No, only for types that exist in C#. So component that you have made in C#.
3. You can attach a Constraint component, Plain, Point or Line, to restrict rotation or movement on the entity.
4. Same as last question
5. Can you elaborate on your question? Not sure I understand
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Re: Some issues to make a breakout with C#.

#3
Thank you for your reply.
I understood about 1, 2 and 3.

4.
In Unity game engine,
Rigidbody component has Constraints -> Freeze Position and Freeze Rotation property
to supress movement of position and rotation.
About 4, I resolved by constraint component.

5.
In Unity game engine,
I can attach physic material component
to specify Dynamic Friction, Static Friction, Bounciness, Friction Combine and Bounce Combine.
I want to avoid the ball speed decreasing every time the ball hits the block.
I resolved it by next code, but this is not smart.

Code: Select all

protected override void OnUpdate(float frameTime) { //速度を維持する。 //Maintain speed. var entity = Entity; var physicalEntity = entity.Physics; Vector2 vec2nom = new Vector2(physicalEntity.Velocity.x, physicalEntity.Velocity.y).Normalized; physicalEntity.AddImpulse(-physicalEntity.Velocity); physicalEntity.AddImpulse(new Vector3(vec2nom.x, vec2nom.y, 0.0f) * moveSpeed * frameTime); }

Re: Some issues to make a breakout with C#.

#5
Hey toyashiwasu,

The CryPhysics system is designed for realistic physical simulations. When you are counter-acting the system by adding opposite angular momentum or velocity (to lock rotation/reset velocity) then you are causing unrealistic behavior.

The physics simulates Friction and Elasticity of the objects, you will lose energy and energy will be redirected in different directions than for a perfectly friction-less and elastic object. Imagine a ball spinning extremely fast, if the ball hits a wall the energy will be transferred in such a way that the ball will zoom off in relation to the spin. Zeroing rotation does not affect this. Unfortunately it is not possible to cripple CryPhysics in such a way to allow perfectly frictionless and elastic interactions. Though, you could probably implement your own systems for intersection detection/prediction (for collision), bounce angles etc all in C# itself.
Uniflare
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Who is online

Users browsing this forum: No registered users and 2 guests

cron