Tag Info

New answers tagged

0

See https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/UPrimitiveComponent/index.html It has all kinds of functions (Similar to unity). One being AddForce. Also, some physics is handle by Nvidia's Physx but I don't know how much of that you would interact with


1

Make the float move variable a class variable. Then create 2 methods which the left and right UI buttons will call on Pointer Down, e.g. MoveLeft() and MoveRight(). Inside them, set move = -1 for left and move = 1 for right. If you want the character to stop if the buttons aren't pressed, you can also make a StopMoving() method on Pointer Up for both ...


2

Your groundCheck Transform is a child of the player and rotates around the player when the player spins. The groundCheck's primary function is to provide a position to use when calling OverlapCircle(). This means it could be replaced as follows: public Vector3 groundCheckOffset = new Vector3(0f, -1f, 0f); // one unit down // ... grounded = ...


1

Sounds to me like what you need is to define a box in the middle of the screen, and only if the car moves outside of that box then the camera will move. That way the car has a bit of freedom to move without the camera moving, but as soon as it gets too far away from the center of the screen the camera does follow it. This is similar to the technique used in ...


1

There are lots of ways to do this, though MoveTowards seems reasonable for your purposes. Essentially, you'll want to determine some speed you want the camera to follow the car. Let's say that's float cameraFollowSpeed; Then you need to adjust that to be framerate independent with Time.deltaTime So now FollowCar's Update() your code is something like ...


1

You could sum it up like such: Pre-game install: You can't assume they are there. Post-game install: You can assume (hope) that the XNA 4.0 Redistributable installed correctly and the assemblies reside in their respected locations. If the scripting that the user will be doing is tested and run solely in game, then I would think that this is a safe route ...


0

Try something like this public Vector2 jumpDirection = new Vector2(0f, 1f); public float jumpFocre = 500f; //... float move = Input.GetAxis ("Horizontal"); jumpDirection.x = move; GetComponent<Rigidbody2D>().AddForce(jumpDirection.normalized * jumpFocre); In this way you are giving to the jump force the x component that the user are triggering in ...


1

Your code currently contains : public float jumpFocre = 500f; //... GetComponent<Rigidbody2D>().AddForce(new Vector2(0, jumpFocre)); Rigidbody2D.AddForce() takes a Vector2 as a parameter, so this can be changed to: public Vector2 jumpDirection = new Vector2(0f, 1f); public float jumpFocre = 500f; //... ...


2

void FixedUpdate() { ... if (grounded) doubleJump = false; static float move; //Only allocate memory once move = Mathf.Max(Input.GetAxis("Horizontal"), 0); //New; nullify negative values //move = Input.GetAxis("Horizontal"); //Old; positive and negative anim.SetFloat ("Speed", Mathf.Abs (move)); ... } or void FixedUpdate() { ... ...


1

This has been discussed a few times in Unity's forums. This thread has a long discussion about the issue, and this and this Unity answers posts. If you don't solve it and everything seems to work fine, I suggest submitting a bug to Unity. Remember this is a warning, so it is possible that even though you see it everything will work well. Usually it happens ...


0

C++ and C# can interact quite easily. (In the practice C++ issues relative to name mangling often force to have an intermediate C layer) There are several resources you can have a look such as Mono P/Invoke docs and unity docs on native plugins. Calling a C# function from C++ code is simply as using a function pointer (a C# delegate can be marshalled to ...


0

Unity uses its own messaging system to call methods like Update. You can use it as well with for example Component.SendMessage. I think that the underlying implementation of the message system uses some form of reflection to determine what methods a class has and call the appropriate ones. (This post's answer explains it better)


1

Scripting languages often expose a set of API functions that allow you to inspect and determine attributes about a loaded script, in your case what functions are defined. This varies by scripting language naturally and will also depend on your native language to scripting language bindings. In Lua for example, I can load a script and then check whether a ...



Top 50 recent answers are included