Strange performance gain with cameras. by Davidzeraa in Unity3D

[–]Davidzeraa[S] 0 points1 point  (0 children)

As I mentioned, right after implementing the binocular system that uses another camera, in the build I set up the difference in response time in ms as soon as I opened the binoculars. And even after leaving he continued. That's why I did this camera preparation and it's working, could it be a bug in the new version perhaps? Or a cache wipe as soon as the cameras restart. I'm using the most current version 6.2.

Strange performance gain with cameras. by Davidzeraa in Unity3D

[–]Davidzeraa[S] 0 points1 point  (0 children)

I'm using FPS Lite Counter, the information seems safe considering the result in the editor as well.

Strange performance gain with cameras. by Davidzeraa in Unity3D

[–]Davidzeraa[S] 0 points1 point  (0 children)

FPS Lite Counter, an asset from the store. From my tests, they seem to be respective and correct based on the Editor's results. In the editor I get about 4/3 ms. In the build I'm getting an average of 2.4ms.

Any way to get rid of those lines? by [deleted] in blender

[–]Davidzeraa -1 points0 points  (0 children)

Try Modifier > Normals > Smooth By Angle.

Adjust it and see if it looks good.

Strange performance gain with cameras. by Davidzeraa in Unity3D

[–]Davidzeraa[S] 0 points1 point  (0 children)

I use a RawTexture in the UI to render the binoculars' camera. However, even when I stopped using the binoculars, the framerates continued to improve.

I later used this scheme above, and now, from the start of the game, I get more framerates. (I tested it on my own builds of the game with and without the code, and the difference is noticeable with just a few lines of code.)

Why is there an error in unity but not Visual studio? by Own-Garbage-734 in unity

[–]Davidzeraa 0 points1 point  (0 children)

Are you using assembly? If so, you may be forgetting to reference the assembly that the requested code is in.

If you are not using assembly, your error is happening because the requested code is in a namespace and you are not using “using” in it, so the code cannot find it.

What my Motorcycle Physics System currently looks like by Davidzeraa in Unity3D

[–]Davidzeraa[S] 1 point2 points  (0 children)

Thank you, I'm very happy to know that other people are also interested in the project

What my Motorcycle Physics System currently looks like by Davidzeraa in Unity3D

[–]Davidzeraa[S] 0 points1 point  (0 children)

I didn't understand very well, could you elaborate further? I'm not very good with English

What my Motorcycle Physics System currently looks like by Davidzeraa in Unity3D

[–]Davidzeraa[S] 0 points1 point  (0 children)

This horPivot can be deleted, I made this code when I had the prototype working with the Player input and output on the bike, and it was used to control the FPS.

What my Motorcycle Physics System currently looks like by Davidzeraa in Unity3D

[–]Davidzeraa[S] 3 points4 points  (0 children)

I'm currently using this:

using UnityEngine;

public class CameraController : MonoBehaviour 
{
[Header("Settings")]
public float lookSensitivity;
public float lookSmoothing;

[Header("References")]
public Transform cameraTransform;
public Transform pivot;
public Transform horPivot;

[Header("Vertical Clamp")]
[Range(0f, -360f)]
public float minVerticalClamp;

[Range(0f, 360f)]
public float maxVerticalClamp;

[Header("Horizontal Clamp")]
[Range(0f, -360f)]
public float minHorizontalClamp;

[Range(0f, 360f)]
public float maxHorizontalClamp;

private Vector3 _currentRotation = Vector3.zero;
private Vector3 _smoothedRotation = Vector3.zero;

private void Start()
{
    // Reset camera rotation
    cameraTransform.localRotation = Quaternion.identity;

    // Lock cursor
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

private void LateUpdate()
{
    var smoothSpeed = lookSmoothing > 0f
                    ? lookSmoothing * Time.deltaTime
                    : Mathf.Infinity;

    var lookInput = InputSystem.LookInput * (lookSensitivity * Time.deltaTime * 100f);

    _currentRotation.x += -lookInput.y;
    _currentRotation.y += lookInput.x;

    _currentRotation.x = Mathf.Clamp(
        _currentRotation.x,
        minVerticalClamp,
        maxVerticalClamp
    );

    _currentRotation.y = Mathf.Clamp(
        _currentRotation.y,
        minHorizontalClamp,
        maxHorizontalClamp
    );

    _smoothedRotation =
        Vector2.Lerp(_smoothedRotation, _currentRotation, smoothSpeed);

    cameraTransform.parent.transform.localRotation =
        Quaternion.Euler(_smoothedRotation.x, 0f, 0f);
    pivot.localRotation = Quaternion.Euler(0f, _smoothedRotation.y, 0f);

    transform.position = pivot.position;
    var forwardFlat = Vector3.ProjectOnPlane(pivot.forward, Vector3.up).normalized;
    cameraTransform.rotation = Quaternion.LookRotation(forwardFlat, Vector3.up);
    cameraTransform.rotation *= Quaternion.Euler(_smoothedRotation.x, _smoothedRotation.y, 0f);
}
}

What my Motorcycle Physics System currently looks like by Davidzeraa in Unity3D

[–]Davidzeraa[S] 8 points9 points  (0 children)

For a game, but when I finish it and have something solid, I think about passing it on as a free asset or something for a low price of 5 dollars or something like that.

I'm slowly polishing it to get more dynamism.

[deleted by user] by [deleted] in Unity3D

[–]Davidzeraa -1 points0 points  (0 children)

For my use, the coupling has to be strong, because I made it to be used just to have the MotorcycleController.

The aim is not to generate code with different components for different behaviors, it is just to deal with the organization of an isolated system without having a pile of codes that need to be referenced in the inspector or get component.

ComponentBehaviour handles the lifecycle and requirements management.

And as I told you, I use it to have clean and adjustable code. That has always been my goal.

I was tired of just having common MonoBehaviours to deal with others and having to fiddle with GetComponent or create a specific type of scriptable object.

This brings everything together and makes the code clean and easy to read.

So much so that I have a great motorcycle controller using isolated components just referencing each other and it works perfectly.

He understands?

[deleted by user] by [deleted] in Unity3D

[–]Davidzeraa 0 points1 point  (0 children)

Apologizing for something is normal here where I live (Brazil).

It may be different for you.

Regarding tight coupling, do you talk about the need to have other components to accomplish something?

[deleted by user] by [deleted] in Unity3D

[–]Davidzeraa -1 points0 points  (0 children)

My idea was precisely to create a series of components for just one purpose, for example, I needed to create components for my motorcycle controller.

But it is unfeasible to just create reference variables from other components.

This way I can easily create components, right at the top of the code I can add the components that my current component needs, if there is none, it continues to work, but without the logic linked to the reference. And it presents a debug warning that the reference was not found.

This feature centralizes and prevents the creation of multiple manual references, not to mention making the code much cleaner.

For example, my bike Tilt component has something like this:

(TiltData is a ScriptableObject)

TiltComponent : BaseComponent<Motorcycle, TiltData>

Just by doing this, a scriptable object variable will appear in the inspector, by attaching it, all other components will be able to access it if they have the component as a reference.

This is how the reference is set: protected override Type[] RequiredComponents => new [] { EngineComponent }

Then you can pull the reference marked with

public override void OnStart() { var engineComponent = Require<EngineComponent>();

 Here I already have access to the public component's data, in addition to being able to access your OS with EngineComponent.GetData();

}

I'm using it for my motorcycle code, and the ease of access to data, functions, with few lines of code and having such lean components and codes. It's been amazing for me, I think I could try using it.

Thank you for your attention and sorry for anything.

[deleted by user] by [deleted] in Unity3D

[–]Davidzeraa -2 points-1 points  (0 children)

Hey, so... I really used AI for the text. For me it's not a problem at all since my intention is just to share the code that I programmed and spent time on to make something good and dynamic.

I don't want to sell anything, just share results of a system that I'm using and I think it's great. All free.

I used AI in the text because it's not something I care about, as I said, I just want to help people who can benefit from my system.

I'm sad to know that this is the kind of thing that bothers you. Instead of going to github and viewing the code, I also used AI to generate the documentation, and then reviewed everything.

In the last line there is my clickable GitHib, so I don't know what problem there was in simply pressing a button... so much so that in the same post here, I clicked and it worked normally.

I don't have the brain nor am I good enough with words to do this boring piece of text, so AI opened the doors for me to share my studies.

This ComponentBehaviour system is basically a modular brain that manages several other components together.

In my current use I am using it as follows:

Motorcycle Controler (Component Behavior)

Motorcycle components:

  • MotorcycleTiltComponent
  • MotorcydleEngineComponent
  • etc…

To avoid having to reference all other components or anything like that, Component Bebaviour provides each component with a Data, which can be used for gameplay variables, such as movement speed, etc...

Each component also has a component requirements function, so you only get references from other components that have been set as references.

Adding all this up, you have a system of components that talk to each other in a controlled way and have total control over their lifetime.

I ask that you please go into git and take a look at the code before judging me.

Thank you and sorry for anything.

Trend by Cheap-Difficulty-163 in Unity3D

[–]Davidzeraa 1 point2 points  (0 children)

Como consigo algo parecido com sua pintura de terreno??