Enemy Follow Unity 2d Jittering? - c#

I am currently having trouble with my enemy AI Script. I am currently new to Unity, so I am still learning a lot, but when my player moves and my enemy follows the player, The enemy starts to jitter and I have yet to find a solution to this tiny problem.
Here are the things I've tried out:
I have Cinemachine attached to my player camera follow so I thought it might be that so I changed the Update method and BlendUpdate method to SmartUpdate and LateUpdate.
I tried interpolating the Rigidbody 2d on my enemy character, but it did nothing.
I tried coding the smoothing, (changed update to fixedupdate on Vector2.MoveTowards).
I tried searching for multiple different tutorials and tried all of them.
I looked at forums on the internet but they had outdated answers or no answer, or it was the wrong game engine.
I've been stuck on this problem for 2 weeks already and I feel like I can't move forward with development if I haven't figured this out. I removed my enemy follow script for now. I read in one of the forums that they may be animating on two different clocks, which I understand yet don't understand how to fix, so please do help!

Looks like I figured it out! instead of interpolating the Rigidbody2D on the enemy, I had to Interpolate the Rigidbody2D on the Player and now it's not jittering anymore :D

Related

Unity 2D collision only from above

Im trying to make a simple cloud jumping game with Unity 2D and have faced a problem.
How would i make the player go "through"/"in front of" the cloud when coming under but colliding when coming down again. Or do i need to trigger the jump action somehow when "touching" the cloud without collision?
Thank you in advance. I hope my text was understandable.
I have tried many ways, i don't even know what anymore. Like with ontrigger but idk did i do it right, it didn't work, something with adding a new layer, and polygon collider but how do i even edit it clearly?
I need help :')

Prefab is not direct copy of original

I'm making a 2D platformer and we did all the movement tweaking in a sample scene, so we figured we could make a prefab of the player and just drag it into each other scene when we're designing the levels. But for some reason, the prefab jumps significantly higher than the original and I can't figure out why. As far as I can tell, prefabs should always be an exact duplicate right?
I know public references are easily messed up when using them in a prefab. Have you tried looking through them if you have any? Also anything you set in a serialized field but not in the script itself might have changed as well.

Unity VR Oculus Rift

I have implemented basic player interactions, look, move, grab and move items and it all works fine.
The OVRGrabbable script (part of OVR plugin) makes the grabbed object`s rigidbody kinematic.
As a result, the object in hand is passing through other colliders. When the item is released everything works great but while in hand it passes through all colliders. It does not stop when it hits other colliders resulting passing with the object through a wall and etc.
I know that the OVRGrabbable script makes the object kinematic and that is why this happens. Can I do something to change this default behavior ? I need the object to stop when it hits the table, wall, not to pass through it.
Did anyone tried to solve this? Any advice ?
Thank you.
I have abandoned using the official Oculus SDK. Instead I have implemented VRTK SDK which is working great, and it supports a wider range of VR devices.
If anybody has a similar problem, VRTK solves this problem with colliders and other minor fixes.
https://github.com/thestonefox/VRTK

AI in different-shaped planets - Unity 3D

I am currently working in a Unity 3D project (in version 5.0.1 to be precise) in which the character can walk in different-shaped planets without falling. So it is always attracted by the planets gravity (similar mechanic to the Super Mario Galaxy games).
Now, the problem is when I try to code the AI for the enemies. This AI should be pretty much simple, but because of this thing that I have with the planets shapes, I haven't been able to come up with a solution. The enemy should check where the player is and move ahead to its position. It's a really dumb enemy. But the thing is, that the enemy must be able to track the player and get to its position no matter what planet he is in. So, if the planet is circular, I cannot make the enemy look at the player and then move forward, as I would do in a plane planet.
I have already tried using a NavMesh, but Unity doesn't want to collaborate and ends up making a NavMesh of 1/3 of the planet. I don't understand why. I have tried changing every single parameter of the NavMesh baking but I haven't succeeded.
Another problem that I would like to do is: ¿How would you make a player be able to walk on the surface of any planet, no matter what its shape, in a smooth way while using a Mesh Collider? I am currently achieving this by getting the planet's normal with a raycast, rotating the player so that the Y axis is perpendicular to the normal and applying a force in -Y to simulate gravity. But this brings lots of problems when I implement the Mesh Collider. It results in a jittery effect. But, when I use a primitive collider from Unity, it works fine...
Anyway. What I need the most now is the answer to the AI question. The other one is kinda like a plus.
P.S: It doesn't matter if the solution is in Javascript. I can then translate it to C# :)

Goblin XNA -- Creating a labyrinth style game

Anyone know how to use Goblin XNA to implement ball control in the same way as one might find in the board game labyrinth?
There don't appear to be any tutorials or information at all regarding how to do this, despite there being a demo video displaying just such a thing.
I've setup the environment and gravity and added the ground and a sphere. I use WorldTransformation.Decompose to extract the current orientation of the board. I know the next step will be either ApplyLinearVelocity or AddForce to the sphere based on the current board orientation, but I don't know how to constantly apply these methods to the ball so that the ball is moving in response to the movement of the ball. Adding code to the Draw or Update methods only executes the code a single time. Anyone familiar with Goblin XNA at all and able to help?
As far as I can see in Goblin XNA the Update and Draw methods are called the same way as standard XNA games. Can you give more specific information? source code perhaps?

Categories