Facing AI Seek Behavior issue in Unity - unity3d

I am currently self-learning steering behaviors and am following this lecture I had found which gives a really good introduction about AI implementation aka https://edirlei.com/aulas/game-ai-2020/GAME_AI_Lecture_07_Steering_Behaviours_2020.html.
I've faced an issue when trying to implement the 'Seek' behavior in a 2D game environment in which the 'seek' game object does not try to move towards its target. There are no errors showing in the console but my best guess is that it's because of the use of Rigidbody in the 'SteeringBehaviorBase' class code. I've tried converting it to Rigidbody2D instead but sadly it still does not move.
For further context, I've attached the 'SteeringBehaviorBase' and 'SeekBehavior' classes onto my 'seek' game object and a circle collider on my 'seek target' game object. I've also set the reference of the seek target property in the 'SeekBehavior' code to the 'seek target' game object.
I would really appreciate anyone's help in guiding me to solve this problem.

Related

unity character attached to game object

I'm quite new to Unity and there is one thing i couldn't think of how to make it and i couldn't exact information either so here i am. (sorry, my English is not perfect)
what i want to do is attaching a character to game object.
In my game, player(user) will control or steer the game object and the character attached to the game object just Looks as if it's riding or driving the game object.
(to help you understand, maybe you can imagine that player control a skateboard and there is a character on it)
So far, I tried 2 ways -
1. I made character as child of the game object, and gave an animation to the character but i found out it is not looks very natural.
2. I made a ragdoll and tried to attach it to the game object by using fixed joint between the game object and the character's feet but in playing mode, only ragdoll's feet was moving with the game object.
So I wonder if there is a good way to do it.
Anybody can give me an advice? I would so appreciate it.
Thanks in advance.
Your solutions is here, and its called IK:
1https://docs.unity3d.com/Manual/InverseKinematics.html
Invere kinematics isn't an easy topic and you will have to test it a lot(of course you could find some workarounds) but if you want the most elegant solution give it a try.

using NetworkLobbyManager with dynamic NetworkStartPositions

Having some trouble getting the NetworkLobbyManager to honor my NetworkStartPositions. This stems from the fact I generate my board dynamically when the game scene is loaded in my GameManager object.
I tried disabling auto spawn in the NetworkLobbyManager but it prevents LobbyPlayers from spawning too.
I would move my GameManager or NetworkStartPosition Spawner up into the Lobby scene but that doesn't seem like the right answer.
Here's where I am in my project: https://github.com/jakecoffman/tanks-unity/tree/f397b8b4e494461b94c718f1997d7572e5c6821f
Any suggestions? Any other tips on my project are welcome too.
I found someone else's project on Github that overrides OnLobbyServerSceneLoadedForPlayer and sets the position of the game player. Still not sure how to use NetworkStartPosition, but this is simple enough!

Unity3d strange Collider behaviour

I found something I can't understand. I'm only a beginner, so I thought I could use the CarController Scripts of the Car Demo for making a little driving game with different models.
the Car demo I wonder why the colliders are sub-objects and the RigidBody has "Gravity-Enabled" without falling apart.
my try to copy my model falls apart with the same configuration.
1.what's exactly my mistake?
2.How can I fix this?
3.Should I rather write a script for applying the gravity to my model?
Most likely all of your objects with Colliders have also Rigidbody component. Try removing all these components and leave only one on a root object.

Unity Sprites - Collider not working Properly

I was following a tutorial on how to create a simple game called pong. As I was working on it. I stumbled on a bug that when the ball is to fast it will it passes through the paddle without colliding with the collider
As you can see in the screenshot
Is this some kind of a bug in unity? I need to get rid of this and don't want to have this in my game.
by the way this was the tutorial I was following . Brackeys
What do you mean by 'bypass the player control'? Do you mean it passes through the paddle without colliding with the collider, even though it should? Or does it get stuck? The screenshot makes it difficult to tell.
Either way, the first thing you're going to want to try is changing the collision detection setting of your Rigidbody2D component from 'Discrete' (the default value) to 'Continuous' or 'Continuous Dynamic'. Fixing this sort of issue (collision errors for fast-moving objects) is exactly what those options are for.
Source: http://docs.unity3d.com/Manual/class-Rigidbody.html

Unity: Third Person Collision with Animated Platforms

first time posting on stack and everything looks promising so far! I had a bit of a complicated question here so I'll do my best to provide exact details of what I'd like to get accomplished. I'm working with a third person controller in unity, so far everything is going great. I've dabbled with basic up and down platforms, a little glitchy but things work. Anytime my player runs through a mesh I make sure the mesh collider is working and a 'rigid-body' is attached set to Kinematic. Here's the kicker, in my game I have turning gears which the player can jump on. This is great except for the player doesn't turn with my gear, which would make sense according to my game-play. What would be the process for getting my character to interact with this animated mesh? I imagine some sort of script which my nooby mind cannot fathom at this point in my unity career. If anyone out there knows the solution to this, I would love to have any assistance, either way I'll plugging away at a solution. Thanks again!!
This is assuming that you're using the packages that ship with Unity3D, which it sounds like you are. After importing the Character Controllers package, you'll have a bunch of scripts in the Standard Assets\Character Controllers\Sources\Scripts folder, in the project hierarchy view. There's a script in there called CharacterMotor.js, attach that to the same GameObject you're running ThirdPersonController on.
Essentially this script adds more interactivity between the character and the scene. There's several methods inside this script that automatically move the character when in contact with a moving object (as long as it has a collision mesh) basically by inheriting the object's velocity.
If your gear/cog wheel has a proper collision mesh set up, adding this script to your character should be all that you require.