Categories
Game Creation Mastering Development

Control Cenimachine Freelook script from another script

I want to control variables on cenimachine script from another script. I want to control the speed of the camera rotation on the xAxis, but when ever I define a variable and replace it in the code: public AxisState m_XAxis = new AxisState(-180, 180, true, false, xSpeed, 0.1f, 0.1f, "Mouse X", true); I defined xSpeed […]

Categories
Mastering Development

how do I format quadratic equation output?

Everything in my program works except when it prints out "The solutions are: " s1 and s2 print out with a +0.00j after the answer. How do I format the output to just be two decimal places? As you can see I tried the ,.2f but it didn’t work, any help would be appreciated. import […]

Categories
Game Creation Mastering Development

A field initializer cannot reference the non-static field, method, or property ‘CinemachineFreeLook.Variable’

engine: unity coding language: c# I am trying to control CinemachineFreeLook maxSpeed from another script in the struct AxisStat: public AxisState(float minValue, float maxValue, bool wrap, bool rangeLocked, float maxSpeed, float accelTime, float decelTime, string name, bool invert) It only accepts to type a number, but not a variable. Whenever I create a public float […]

Categories
Mastering Development

how to best iterate through dictionary keys and compare the values?

I am very new to Programming and only started learning Python 3 about 2 wks ago. Doing an exercise that I found rather difficult, that is designed to create a function that accepts a dictionary as an argument and is supposed to determine if the dictionary represents a "valid" chessboard. Plz note the following codes […]

Categories
Game Creation Mastering Development

Unity: Sprite stretch issue

I have a simple png square 8px x 8px. In Unity I’ve left the pixels per unit at 100 and added the image to the scene to create a prefab of the item. I then add four items to the screen like so: var block = Resources.Load("Prefabs/Block", typeof(GameObject)); Instantiate(block, new Vector3(1f, 0f), Quaternion.identity); Instantiate(block, new […]

Categories
Game Creation Mastering Development

Unity3D – Despite using Time.deltaTime, my camera and player move faster at higher framerates

I’m pretty new to c# and Unity so I wouldn’t be surprised if I had made some stupid mistakes, but as far as I know, I don’t think I misused Time.deltaTime. Any help would be greatly appreciated. Movement Script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public CharacterController controller; public […]

Categories
Game Creation Mastering Development

How to extrude mesh?

Say we have the following simple mesh data: // additional data // Vector3(x, y, z) – +x left, +y up, +z forward // triangle indices are in clocwise order // list of vertices that form a place List<Vector3> vertices = new List<Vector3>() { new Vector3(2f, 0f, 2f), new Vector3(-2f, 0f, 2f), new Vector3(2f, 0f, -2f), […]

Categories
Mastering Development

Unity2D – How to move and rotate particle system around a circle?

I’m trying to instantiate a rain particle system to follow a circular path. The clouds rotate and move around a circular planet perfectly fine. The problem arises when the particle system is instantiated, it almost never has the correct rotation, no matter where it is spawned. I tried making the particles a child of the […]

Categories
Development Game Creation

How do I initialise levels sequentially?

I have been learning opengl and I have made good progress over past few months. However I still struggle to understand game logic in C++, I am new to C++ too. Say I have this program. #include <headers> int main() { #Step 1 VAO_VBO_EBO_inits(); while(!glfwWindowShouldClose(window)) { glClearColor(.2f, .2f, .3f, 1.f); glClear(GL_COLOR_BUFFER_BIT); #Step 2 DrawCalss(); glfwPollEvents(); […]

Categories
Development Game Creation

What is Unity Quaternion range?

I’ve read somewhere that a Quaternion in Unity ranges between [-1,1] values. I mean the individual XYZW values. Ex: new Quaternion(.1f,.2f,-.3f,-.4f) Is this true? More clearly: I know they take float values therefore the theoretical limit is floating point value limitations, I’m asking the real rotation results. For instance when I look up Quaternion values […]