#⚛️┃physics
1 messages · Page 2 of 1
Tilemap colliders:
Player collider:
The collision between the player object and the tilemap is not happening, the player just falls trough it
remove rigidbody or make put them in different layers
or change the rigidbody body typee
.
Does the player have a Rigidbody2D?
andhow is the player moving?
do you ahve a script
Also note you're using Outline mode on the composite collider
and discrete collision detection on the player
both of these may contribute to frequent tunneling
I do have a script, but it's falling because of the rigidbody2d
So what should I use?
and should I send the script
polygons and continuous
can't hurt
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
[SerializeField] private float move_speed;
// [SerializeField] private float jump_strength;
[SerializeField] private Rigidbody2D rb2D;
// [SerializeField] private CapsuleCollider2D cc2D;
// [SerializeField] private BoxCollider2D bc2D;
// [SerializeField] private LayerMask ground_layer;
// Start is called before the first frame update
// Update is called once per frame
void Update()
{
//Jump();
}
private void FixedUpdate(){
Move();
}
private void Move(){
float dirx = Input.GetAxis("Horizontal");
Vector2 velocity = new Vector2(dirx*move_speed*Time.deltaTime,rb2D.velocity.y);
rb2D.velocity = velocity;
}
// private void Jump(){
// if (Input.GetButtonDown("Jump")){
// Vector2 velocity = new Vector2(0,jump_strength);
// rb2D.velocity+=velocity;
// }
// }
}
It's still falling trough
why are you multiplying Time.deltaTime into the speed
all that's doing is forcing you to multiply your move_speed by 50
anyeway next thing to check is that your tilemap colliders are shaped how you actually expect
and that the objects aren't on layers that ignore each other etc
theyre on the default layer
the colliders look fine
show the player's collider gizmo
and can you show the hierarchy of the player?a are there any parent/children etc
.
ah right
I mean it should work I think with the stuff you've shown but we must be missing something
can you show a video?
i can screenshare
dont really have any recording software on my pc
i think that ive been messing with layers
but im sure i havent touched the default layer
you said the objects were in the default layer
default collides with nothing (not even itself) the way you have it set
oh i configured the layers but i didnt set the layers to the objects
ohhh
so to fix this i need to set the player layer to the player object and the ground layer to the tilemap object right?
sure
thanks dude
or re-enable default/default collisions
appreciate it
does anyone know any tutorials which could help me make a realistic car controller (this includes: soft-body wheels, suspension, downforce, steering, transmission, handbrake, some hp + torque system, etc)
idk, i think im asking for too much
I want to limit my character's x speed by applying a dragforce only on that axis but I can't seem to get it right
_rb.AddForce(transform.right * (-Mathf.Abs(_rb.velocity.x) * _playerStats.horizontalDrag));
rb.velocity.x and transform.right are not necessarily on the same axis
you need to project the velocity onto that axis to figure out which part of the velocity is along that axis
on top of PB's comment about projecting your velocity onto the correct axis, using absolute value is wrong in this context. If you're x velocity is negative (after the projection onto the local x-axis), you want to apply your force in the positive x direction. You just want to be flipping the sign of the velocity, not taking abs.
is there a runtime function that decomposes concave mesh collider into colliders primitives?
I don't get why I would need to project it
This works ok based on tachyon's response though i'm not sure about it
_rb.AddForce(Vector2.right * -_rb.velocity.x * _playerStats.horizontalDrag);
what's the easiest way to detect terrain/collider contact?
my collider cannot be a trigger, it has to keep working as a physics object.
I tried the following but I get no results:
public class ColorContact : MonoBehaviour {
public bool inContact;
private MeshRenderer meshRenderer;
// Start is called before the first frame update
void Start() {
inContact = false;
meshRenderer = gameObject.GetComponent<MeshRenderer>();
}
private void OnCollisionEnter(Collision collision) {
Debug.Log("OnCollisionEnter");
foreach(ContactPoint contact in collision.contacts) {
Debug.DrawRay(contact.point, contact.normal, Color.white);
if(contact.otherCollider.gameObject.name.Equals("Terrain")) {
meshRenderer.material.color = new Color(1, 0, 0);
inContact = true;
}
}
}
private void OnCollisionExit(Collision collision) {
Debug.Log("OnCollisionExit");
meshRenderer.material.color = new Color(1, 1, 1);
inContact = false;
}
}
every model has a ColorContact
at least five parts and more likely 9 should be red and inContact=true.
aha. I'm putting the contact test in the wrong place...
i traspass the colliders sorry i speak spanish
give your terrain a tag, or check if the collider you collided with is a TerrainCollider, or check the object for a Terrain component
hi guys , i'm trying to make a lot of coins collide together, but when there are a lot of coins, my fps drops down dramatically. I'm using a mesh collider since there are no primitives to fit a coin, and i read in the docs that mesh colliders require more use of the computer. Is there any tricks you can give me?
How many coins you need before it starts lagging? How many tris/verts are in each coin?
Other than simplifying the mesh, i dont know any good ways to optimize
Also could try to make the coin out of few box colliders
@unique cave When hitting 100 coins, i start to be under 60fps, than around 180 coins, i drop to 30, with drop to 8 and so.
The mesh is a simple coin with 2 faces for the... big faces, and 24 faces on the edge. I tried to do less faces on the edge and it is not very conclusive.
I tried with a few box colliders too, and it was worst!
Do you know if i can do 2D colliders on the big faces and still use it in 3D? (just an idea)
No you cant
Theres no circle collider 3d
Yeah, i know, that's the problem :/
Do you drop the coins in some sort of container or on a plane or?
On a plane with 3 sides, include one pushing (like a coin pusher game)
and when i have an amount of coins being pushed, it start to drop down fps
Maybe share a screenshot
Do you use mesh collider for that plane/walls stuff?
i was but i changed to a box collider
Then I dont have many suggestions anymore
Ok. Thanks anyway 😉
anyone know how to stop a joint from being affected by objects? so for example my player jumps on a platform fixed on by a joint, but it doesnt make the joint swing etc.
joints don't swing or move, only the Rigidbodies they connect do
Are you asking how to make the platform not move?
how to stop the player from affecting the platform basically 🤷♂️
make the platform kinematic
another option is disable collision between the player and the main platform object, and give the platform a kinematic child object, with which the player actually interacts.
oh thanks that works 👍
Not entirely sure where to put this, but i'm trying to rotate using torques for something, and I can't quite get the result i wanted. I've tried rotating using a force multiplier and a slerp in the torque, and i've tried using both the eulers and quaternions in a PID loop, and they always just keep spinning
does anyone know what might be better?
what kind of game is it? what do you want to achieve in terms of gameplay?
I'm trying to get some segments of a blade to follow given points using forces. The positions are followed fine, and I think i got the rotations working now too.
The idea is for the blade to sort of "come apart" when swung, to propel the shards
does it have to be realistic movement or does it primarily need a lot of control to create fun gameplay?
i'm not sure where it'd fall tbh. I can post a video of the current state of it
i hope this shows what im trying to do
Im currently having this issue where making the integral parameter of the PID any non-zero number causes all the segments to spin around
Hey guys i need help. I have a game where you controll a little square but i am loosing my mind now. 1. Sometimes, randomly when starting the game the fps drops down from 500+ to 100 when moving the player and 2. also randomly when starting the game sometimes the player moves slowly and sometimes fast. WHY IS THIS HAPPENING? I changed nothing in the code but sometimes it happens and sometimes it doesnt...
Update: the fps drops are only when i have the player object selected in the editor while playing?
- Rigidbody inspector particularly is known to be very hard on your CPU.
- Your code might not be framerate independent
Already got the one solved, what do you mean by Frame indipendant? Sorry im a bit new
Oh I get it
Thanks
How do you come up with this stuff 😀
Morning 🙂 Is there an easy way to get my rigidbody character moving over this small incline? When he's walking he collides with it and stops. He only gets over it if he's running.
Use a sufficiently large capsule collider (janky), make a kinematic controller that can smooth out small bumps (recommend) or remove the collider of the bump (good in any case)
Didn't think about removing the collider, that could work. Thanks for the tips
I am having issues with a box collider 2D getting caught on a tilemap collider, anyone know how I can fix this: https://stackoverflow.com/questions/73477013/box-collider-getting-caught-on-tilemap-collider
so i have a character with a really baggy type cloth in blender that needs to be simulated ,, but i don't know how to go about it. should i simulate in unity , in blender? and i'd also really appreciate a tutorial on this topic since i couldn't find any that are remotely close to what i need
Let's just say none of these problems are novel
What is the default friction factor when having no physics material?
Is it 0.6?
I'm having issues with a hinge joint rope at the moment, so when the player swings it won't meet a climax and kinda keep going but slowly losing speed as you hold down the arrow key and then when you release it slowly goes back down like there is some sort of resistance, does anyone know why this is happening, thanks!
I want to make a nerf gun like projectile in my game, but I'm stuck between spawning physical projectiles to shoot at the target or using a raycast. My thought is that since nerf darts are slower than regular bullets, having damage being dealt before the dart reaches the target would look wonky. Which is better for this situation, or if there's another method tell me
I need help
when i click the particle in the editor window it doesnt auto play and the box that shows up in peoples tutorials wont show up.
I'd say spawning physical projectiles is better for sure, since there's a significant travel time. Especially useful if you want these nerf darts to have gravity or anything like that
How would I make a rigidbody more "squishy"?
I have an cube that I want to make de-bounce slowly from collisions, almost like a spring or rubber ball, rather than being like a solid metal block. Not neccesarily referring to the bounciness, but the ability to penetrate and de-penetrate surfaces, sort've like skin width on a character controller.
probably a collision detection script that uses direction, velocity, and collision location to add force to the ball. there are a good few 5 minute videos on youtube on it
Hmm… I tried youtube but didn’t have any luck, what would I search? Everything I’ve found so far doesn’t get into collision location/distance and adding custom forces, and only covers the basic rigidbody functionality
https://www.youtube.com/watch?v=dLYTwDQmjdo
in this video it looks like he makes it pretty bouncy just with the rigidbody settings
nvm he actually sets the bouncyness of the ground material
just look through the first 10 minutes and it explains it
Awesome, will take a look. Thank you :)
your welcome
That was a very helpful video, but my issue now is that the OnCollisionX methods don't actually detect collisions against concave mesh colliders, which is practically my entire scene, and because I have a fairly detailed environment I'm not sure I can mark everything as convex (and not sure if this would reduce performance or have other weird side effects on the rest of the gameplay?)
Is there another way I could push the player away from walls and any other objects this bounding box around them might overlap with? Would Physics.boxcast or something like that work against concave mesh colliders?
Maybe it would be best to create an invisible, solid rigidbody and have a spring join connecting and pulling the player towards it? It just seems difficult to work with and really control the behavior of the collisions 🤔
- OnCollisionXx and Raycasts all work with concave mesh colliders (as long as the concave object is static)
- marking things convex will only inprove performance, but may unacceptably alter the collider shapes
I see. All of my environment mesh colliders seem to be marked as static for everything except "Contribute Global Illumination", so that should work for detecting collisions then?
I must've missed something else, since the object with the OnCollisionStay script only seems to detect collisions from the player object/collider.
The object with the OnCollisionStay script has a box collider and kinematic rigidbody. It is also a child of the player object, which has its own non-kinematic rigidbody and capsule collider, if that affects anything.
Thank you very much for the help 😁
There needs to be a dynamic Rigidbody involved
OnCollisionXx won't work with kinematic/static or kinematic/kinematic pairs
Only OnTriggerXx
Damn. Okay. And you said box cast would work as well, as an alternative?
I might try that since I would like to have things like contact.normal and contact.distance and all. Then if that doesn't work I'll see what I can do with a trigger collider 🙂
hey everyone, for some reason my code doesnt work. i wanted to instantiate a bullet and make it look at some position, so it flies towards it. but it spawns rotated in a completely different direction.
private void SpawnBullet(Transform posToLook)
{
Vector3 diff = (posToLook.position - transform.position);
float angle = Mathf.Atan2(diff.x, diff.y);
GameObject instance = Instantiate(Bullet, transform.position, Quaternion.Euler(0, 0, angle * Mathf.Rad2Deg));
}
That's not really a physics question but
Vector3 diff = posToLook.position - transform.position;
Quaternion rotation = Quaternion.LookRotation(diff);
GameObject instance = Instantiate(Bullet, transform.position, rotation);
kinematic/kinematic pairs need to be enabled specifically in physics settings for this to work
your atan 2 x and y are backwards
it's y, x
Hello,
Wanted some advice on custom coded character controller.
Wanted to know the pitfalls of not using rigidbody for it.
With non kinematic bodies
I know collision resolution and physics engine calculations are a great benefit but at times when there are aracady stuff involved, for eg “jump cancelling and in air attacks and hit feedbacks like dmc”
It feels like it would be fighting the framework a bit so would it be or not ? Since non kinematic bodies will receive forces from collisions so how would this go ?
After tons of thinking I am avoiding rigidbody component at all and whatever physics I require im coding them myself (jump/ground detection/gravity)
But what im concerned about is the scalability of it.
I know going custom itself mean everything doing by myself but what im concerned about is it is okay at a larger scale ?
Basically its like I dont know what I dont know and wanna know about problems at larger scale which I would potentially face.
Btw its a heck and slash combat game.
And im using overlap boxes raycasts and static colliders for physics related stuff.
The main pitfall I can think of is that you won't be able to get OnCollisionXx or OnTriggerxx callbacks at all without a Rigidbody. You should have a kinematic body at the very least.
It's actually considered bad practice and poor for performance if you have a collider that moves without a Rigidbody. When there's a collider with no Rigidbody, the engine considers that a "static" collider and doesn't expect it to move. It makes certain optimizations around that.
In short, I recommend adding a kinematic body
I dont need the onCol and OnTrig callbacks.
Other than those ?
Also moving static colliders dont incur a penalty post unity 5.3 and integration of physx 3.0.
And im on 2021 so there’s no problem there too ig
I dont exactly know where to ask fo help with this but does anyone know how to fix the ragdoll?
As Dante said, thats not an issue anymore. Back in the days moving static objects used to be very slow but nowadays static objects uses same aabb tree as dynamic ones so adding kinematic rigidbody wont help performance wise https://blog.unity.com/technology/high-performance-physics-in-unity-5
it looks like your AnimationController is fighting with the physics engine. The AnimationController is directly controlling some parts of your model, which makes them ignore physics. But other parts are not being controlled by the AnimationController (because the animation doesn't have values set for those parts) so physics affects them.
When you want to apply physics, you need to turn off the AnimationController and the ragdoll should work okay.
Hmm I might have written it wrong in the script u thought I had done that thank you!
how do i stop the player from getting bounced up when they stop on a slope?
presumably it's your code doing that, so... fix your code.
it's because you are letting the y velocity continue when you release the button
In your fixedUpdate, you use the existing y velocity always
your video is just the existing y velocity you had continuing without any x
(hence why the "bounce" is smaller on the shallower slope)
I'm sorry, im new to game dev could you help me with how i can fix this
Hi, in my level I need to spawn a ton of rigidbodies, which is hurting the performance a bit. I don't need them to be a rigidbody all the time though, only when close to the player. Will setting them as kinematic help on the performance? (just faking it by modifying the transform when far away from player)
you could AddComponent the RB when it's close and Destroy it when it gets far perhaps?
Or try kinematic, yes
Anyone know y the outlineis bigger than the actual thing
wasnt sure where to post this
Hello, asked for help a couple weeks ago but haven't figured out a clear solution for this.
Trying to work with wheels for a car, trying to emulate an old arcadish racing game's suspension, but the wheel collider was giving me issues and I don't know how to tweak its settings to get a similar effect to what I was trying to emulate.
So attempted to make a custom suspension gameobject instead, using two cubes and a sphere with this structure:
-two cubes, connected to each other with a spring joint for suspension, and a configurable joint to lock movement to one local axis.
-The sphere is connected to one of the cubes with a hinge joint.
-The other cube is connected to the car using a fixed joint.
Here's the issue: When I tried to test it by using a PlayerController script that applies torque to the four spheres to make the car roll forward and back, the suspension object's fixed join starts to glitch, spring back and forth, then cascades into what the video shows.
No idea what could be causing that because I set the suspension to not collide with the car through collision layers and there's no other script on the car than the one applying torque on the wheels.
Anyone happens to know what could be causing that and how to fix it?
It's the video I had posted here #⚛️┃physics message
because that's how the function works
it has nothing to do with unity
just trigonometry
bruh dyno lick me bro
he's right tho
atan2's params are also 'flipped' in all the other engines / math libs I've used
it's just the way it is
some things will never change
just lost two hours because apparently changing a rigidbody parent object doesn't work correctly and you should change the rigidbody position directly when you need to do it
hope this message helps someone 😛
there's also Physics.SyncTransforms but yeah if the RB is dynamic it doesn't really care about the Transform hierarchy
when my player attaches to a rope the rope acts odd...when the player swings it will swing in that direction but you can constantly keep going in that direction and when you release the button it slowly brings the rope to the starting position instead of swinging. Does anyone know why this happens and how to fix it?
where do I ask help for code?
code-beginner, code-general, or code-advanced
Anyone know how I can flip my car upright after it flips on its side or it's back? Perhaps there's even an asset I can use for this?
Hi! I am currently trying to create a waterslide for my game, how do I make the slide actually slippery?
keep in mind this is for a VR game
Using an asset for this seems overkill. Start with setting the transform position to 1 unit above ground you're standing on, and rotation to Quaternion.identity after you detect you flipped on the back (eventually after a few seconds without moving)
Sweet, thank you!!
Hey, im having this weird thing happen. I have a cube as a "floor" i have a capsule that can move, and a cube, all of which are rigidbodies. If the cube and capsule interact, the capsule gains permanent backwards movement. With high friction (on the floor), the speed that the capsule moves back increases, if the friction goes down, the speed the capsule moves back decreases, but the speed the box moves back (when it didnt at all before) increases. Anyone know how to fix this?
Download unity's basic assets and change its physics material to slippery or ice
Probably due to your code
I asked this in code and they said to come here
I didn't say to leave the channel
Thats what i figured tho since the code fixed it then broke
Just that your code is causing the issue
I can check my code later, just not right now. I left out some info tho, the capsule moves at 5 units per FixedUpdate() and the cube is .1 units weight and the capsule is 1 unit weight
K, thanks 😊
How do I make an object to continue moving after hitting a collider ? It's a Topdown 2D game.
Continue moving in the same direction through the collider, or bounce off it?
opposite direction
var magnitude = 5;
// calculate force vector
var force = transform.position - other.transform.position;
// normalize force vector to get direction only and trim magnitude
force.Normalize();
rb.AddForce(force * magnitude);
Im using this code atm.. still trying to get the effect i want
Maybe this is opinion based, but why would anyone use transform.Translate() (except for teleportation, I suppose) when Rigidbody.velocity does the same thing and works with colliders?
I made the mistake of trying to figure out collisions with Translate() and transform.position. Meanwhile, so far Rigidbody.velocity works perfectly.
You wouldn't use Translate for an object you want physics for
it's fine if you don't need physics
.velocity is a state that gets automatically applied while .Translate() is an momentary action that gets applied once. That and that transform.Translate() ignores intermediate collisions while rigidbody.MovePosition() would not. So each is useful depending on the situation.
Ohhhh, I didn't know MovePosition() was a thing. Def gotta find the time to go through Unity's physics documentation.
As far as I know, MovePosition isnt any better than rb.position, it just interpolates the position so it doesnt look that jittery
setting rb.position teleports you
it ignores collisions
MovePosition will respect collisions
I dont think it will
And if you're kinematic it will apply appropriate forces to objects in the way
it does
try it
Why it ignores continuous collision detection mode then? It just moves thru walls
it doesn't
unless your body is kinematic
It does, try it 🙄
if your body is kinematic it ignores collisions anyway (but applies forces to objects in its way appropriately)
I have, many times
Then I have to update my understanding of MovePosition, the documentation page is nothing but clear about that and I have encountered some problems with it earlier
And this guy here seems to understand it same way as I do https://forum.unity.com/threads/rigidbody-moveposition-through-wall.1212954/
It moves through walls but triggers the collision events
putting together a quick little video/experiment
@unique cave @bleak umbra kinematic bodies go through walls. Dynamics don't. This is all with discrete detection.
if you want to try
You need to increase the delta position to be > wallcollider to see an effect. This test obviously resumes the sim after the move in each update
that's just tunnelling then
it's not that MovePosition doesn't respect colliders, it's that Unity collision detection is vulnerable to tunneling in general.
That’s the whole point
2D seems to be better at it than 3d
in fact even with 1000 speed
the 2D dynamic MovePos with continuous detection doesn't tunnel
but the 3D one does
That’s would be the behavior I’d expect. What happens if you just set a position on the other side direct?
rb2D.MovePosition(new Vector2(1000, rb2D.position.y));
about to test
and rb2D.position = new Vector2(1000, rb2D.position.y);
end result
MovePosition in 2D physics is really good at not tunnelling 😛
So it does ignore collision detection mode but doest go thru walls right? Thats what I meant, I phrased it very poorly
I think it doesn't ignore it, but Unity's 3D continuous detection mode isn't very good
2D seems rock solid
good to know
does extrapolated and interpolated change anything in the quality of the detection (or whatever they are called)?
apparently the 3d rb has them for performance reasons
It is very good actually. Try it with velocity and AddForce, its just MovePosition that doesnt work
this one is supposed to be "perfect"
movePosition if the body has a corresponding velocity set should also work, its probably only bad because it doesn't know how far to interpolate
quite pointless though
Interpolation and collision detection are not the same. The interpolate option has nothing to do with tunneling, it doesnt affect the physics at all actually
why is it called collision detection then (i used the wrong words above)?
Tunneling mostly happens when resolving large forces from multiple directions at once, continuous collision detection is very good at high speeds tho, no matter how high force/speed you apply it will not tunnel (once I made pong type of game where I tried this and using velocity of millions didnt cause any tunneling, may not be the case in every scene tho)
I guess the moral of the story is that if you want MovePosition behavior in 3d that respects collisions at high speed - you have to do your own manual ray/volume casting
or maybe you do the math yourself and use velocity, aka do the algebra
d = r*t
and set velocity for one frame
I think that works better (although the object will then keep the momentum)
using a raycast is probably the intuitive thing to do, its such a common pattern
My point was that I think rb.MovePosition and rb.position doesnt have other differences than visually smoother movement (when interpolation is enabled). Im not entirely sure about that but the docs page seems to suggest the same
Im back home tomorrow so maybe I could make little test to see if they are exactly the same
I think where you'll really see the difference is the effect the object has on other dynamic bodies in the scene. MovePosition is ideally for something like a moving platform in a platformer for example.
Or MoveRotation for kinematic paddles in a pinball game as another example
Ill try this tomorrow
I made a cool rb controller. What do you think? https://assetstore.unity.com/packages/slug/229619
How are we supposed to test it if it literally costs 35$, and giving opinions without trying something out is meh
it is -50%
Still expensive
altho it is a good idea to make a demo of some kind
Yea
Hard to know
true
ok i am building for webGL, i will leave a link here soon
here is the demo link https://play.unity.com/mg/other/webgl-builds-241258
this is a demo of my asset: https://play.unity.com/mg/other/webgl-builds-241249
remembre to change sensitivity at first
web gl breaks it
so i put to sliders at the bottom right
Cool 👍
Single rigidbody cant do that. Unitys Cloth component is basically a bunch of rigidbodies joined together
Cloth vs one rigidbody?
Most likely the Cloth component is more optimized than any system that beginners can build themself. Cloth component kinda sucks tho
if i were you i would also consider looking into stuff like nvidia flex and stuff like that, sure dll interop can seem scary at first, but it is well worth it in my oppinion
from testing, it appears to work just as well on amd as on nvidia, although i am uncertain if it will work on phones, i will probably test this tommorrow though
the real limiting factors comes from the fact that it only supports cuda and direct x, and some devices you cant use either
i wish you luck! You can always simulate soft-ish body simulations using rigidbodies and bones, connected together using springs, although this can get computationally expensive very quickly!
good luck with that, if you plan to code it directly i would suggest using compute shaders or/and dots(data oriented technology stack)
i wish you luck!
compute shaders are basically ways to get the gpu to do stuff
welp good luck, and have fun!
Hey, im having this weird thing happen. I have a cube as a "floor" i have a capsule that can move, and a cube, all of which are rigidbodies. If the cube and capsule interact, the capsule gains permanent backwards movement. With high friction (on the floor), the speed that the capsule moves back increases, if the friction goes down, the speed the capsule moves back decreases, but the speed the box moves back (when it didnt at all before) increases. Anyone know how to fix this?
nvm the pill's rotation needed to be locked
hey guys i'm making a 2d platformer and i add force to a rigidbody2d to move horizontally and i set rigidbody's vertical velocity to make it jump can anybody tell me if that's the optimal approach or how i can improve it?
that's backwards from how most people would approach a platformer. If you want really tight horizontal control, AddForce won't work great for you. You'd want to set the horizontal velocity directly and control the logic for how input affects velocity in your own code. AddForce is more okay for jump, but setting the vertical velocity would also be fine. They'd have pretty similar results, though if you're jumping while you already have a vertical velocity (like in a double jump or on a vertically moving platform) they could have different results depending on how you implement the velocity setting one
i have chosen to set velocity for jumping in case i wanted to add double jump however i don't think i can manage converting from inputs to velocity myself
can anyone help with giving a force field a shape with the same pull graph as gravity and have its size&strength be determined by a variable?
Ideally these force fields would be able to combine like drops of water to become stronger thus allowing pretty accurate simulation of electromagnetism, the strong force and the weak force.
This is all for a particle physics game and all I really know is particle physics
@vernal owl Could do metaballs maybe?
Each force field would be a metaball, they'd attract eachother stronger the closer they are
And then they'd merge into a single metaball
I think it would look like you'd want it to look
There should be shaders out there to achieve this
Does anyone know why my rope is acting like this? So in this clip im holding down left and it just keeps going up instead of hitting a limit and then falling back down (like swinging on a rope should do) then when I let go it slowly goes down instead of swinging
You must give more information about the way the rope is implemented. Is it just multiple rigidbodies joined together with some sort of joints? What settings those rbs have etc?
The NVIDIA Flex plugin for Unity seemed to be pretty hard to get your hands on, so I decided to put it up on Github. (testing, research purposes)
https://github.com/Tespinen/nvidia-flex-for-unity
woah nice!
considering how im pretty sure the plugin demo for unity never used flex 1.2.0 i might try modify that, or remake it in the same style to work with flex 1.2.0
I had a lot of fun while playing around with the plugin 😆 But when I tried get my hands on it a while back I had to literally scavenge the whole internet for a download so I decided to do this now. Was supposed to upload it sooner, but I forgot 🤣
Hopefully someone here will also have some fun with it, or use it for research
welp great job, as this is awesome, hopefully this should also be super useful for understanding how flex works, as the manual can be quite vague lol
It might have a few errors and you might have to delete a couple of scripts, but otherwise it should work fine
Whoops. I forgot to mention that in the rep 😆 Better update it
a few errors is fine lol, compared to the no errors and silent failure that i usually get while trying to get Flex working lol
wow checking the version it is actually version 1.2.0 lol
I didn't have time to test if I imported the files correctly to github though. But Unity didn't give me any errors when I quickly tried so it should work...?
oh well, ive got to go to bed soon, but ill try it tommorrow, but looks very promising, great job!
Hopefully lol. Git didn't let me throw the whole file on one go so I had to import everything one by one
unfortunate lol
Good luck to you! And if it doesn't import into Unity, just ping me and I'll try to see what's wrong.
oh also ye it cant be used for commercial stuff i think due to this line in the top of every single file: ```cs
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
Oh. I better add that to the readme file lol
probably
but add a note that nvidia flex in general can be used commercially, just not this specific plugin, meaning if people want to create their own ways of getting nvidia flex working in unity, then feel free
Yeah. Also, I don't think NVIDIA minds the distribution, since there were many other places where you could get it that have been up for years so I shouldn't get any legal trouble lol
ye, plus it is an old version of nvidia flex
the latest version of nvidia flex is kept locked up within nvidia omniverse as a part of physx5
Updated it.
awesome!
i might try compare the performance from that plugin with the performance of their demo app, could be interesting results!
Should spare people from having to research the licensing themselves lol. Thanks!
lol, welp great job for finding the plugin wherever you did lol
Did some more research. NVIDIA doesn't seem to mind the distribution of a download, as long as you don't try to tell people that it's created by you and/or distribute it commercially.
oh ok nice!
hopefully once unity finishes support for nvidia omniverse we will have a proper and more up to date method of using nvidia flex, although who knows how long that will take
Ima test it myself to figure out if it can be imported into Unity properly and if you get any errors that stop you from using it
I think I did import every file correctly since I didn't get any errors in Unity, but I better open the whole project
ooh true, unity does technically have an experimental usd plugin, which should make it possible perhaps
wait nevermind i misread what you said
good job!
It does seem to open the project at least, let's see if I get any errors once it opens
welp great job lol!
Unity says it has compiler errors (at least in 2021 lts, which was expected). Let's see if it's something that stops you from completely using the plugin.
what kind of compiler errors, you could always manually fix the plugin to be unity 2021 compatible lol
we can always use the demo app as a guide if the areas with errors are indecipherable
They might be just fixable by deleting the flawed scripts, or at least that's what I did previously to get it working.
ye, tommorrow im definitely gonna mess around, and do some performance testing, and see what i can get working!
Alright! I'll see what kind of errors it has and send them here and to the rep so people are prepared for them.
ok nice!
(sorry for being so late) @timid dove @bleak umbra This is the test I made: It's 3 physics scenes running on top of each other, red ones are in scene where the cube is moved using rigidbody.MovePosition, blue with rigidbody.position and green with transform.position. They are all literally the same, there's not even z-fighting happening 🔽 . This is all with non-kinematic rigidbodies (collision detection mode doesn't seem to make any difference in this test, meaning MovePosition doesn't take it into account). When the moving cube is set to kinematic, MovePosition seems to give different results than trans.position and rb.position ⏬ . The argument about moving platforms seems to be true, MovePosition really seems to handle that type of interactions correctly/better but only when the platform is set to kinematic (which is bit counter-intuitive), when it's set dynamic, it's exactly as bad as transform.position
Fuck. I imported the packages incorrectly!
It only displays a few of the scripts, and doesn't recognize the rest, thus making it unusable
I'll try to fix it later, but I'll keep a small break.
Added this.
Welp, glad I tested it lol. Now people won't download something that won't work
Gonna fix it later on.
The collision is not working and i dont know why...
oh no box collider aint 2d...
nevermind
still not working
seems like Simulated is unticked, also the way you move the body most likely doesn't take collisions into account (you should use rb.AddForce/rb.velocity etc., not transform.position/Translate etc.)
@worthy glacier Don't cross-post in other channels. Instead provide proper explanation about what's happening and what you expect.
Guessing about what you mean the problem is here, enabling continuous collision on rigidbody fixes snagging on tilemap colliders
but i dont understand whats happening
continuous collision is already enabled
Are you using tilemap collider for tiles?
Are you using tilemap for this at all?
To group regular sprites with own colliders into a single collider object, composite collider should be used
i will relearn basics
My movement script was messing with it, I figured it out : )
Started fixing the Flex rep. Should be working within the next 30 mins.
Found out that the reposity isn't working because there's something different in 2021 lts and later on versions. I don't have the time to figure out how to fix it today, nor to track down a version that it would work it.
Figured it out by opening the original file, and not the github rep in Unity. Same errors and all.
I'll see what I can do tomorrow.
oh ok got it!
probably something to do with meta files if i had to guess
Yeah, probably. I'll try to get it working. Otherwise I'll just send the folders to git and add instructions on how to add them one by one to Unity.
got it! After some homework ill try see if i can get it working lol
You could probably just download the rep and then open your project, and drop the folder titled "Flex" to your project
That should work
Gonna test that myself once I get home from work.
Actually, that might be a better way in general, since you can use it in an already started project, plus I don't think Unity recognizes the Meta files since I didn't import them properly to github. I'll probably just add instructions to drop the Flex file to your projects to the Readme.
That is of course if the files in general work
wouldn't work i think due to the fact that the assets folder is inside the flex folder
should do we hope lol
im just really excited to use it as a 2nd reference, so when im building my own solution in unity i have both the demo app and the plugin to guide me on how on earth to make stuff work lol
I could probably delete and/or move the assets and such to a different folder to get it working.
dont worry lol, it will be fine, cause people can just drag and drop everything from inside the flex folder into their unity project!
Yep. I'll edit the rep to suit that approach and add some instructions to do so once I get home
ok nice!, and perhaps add a mention somewhere on it that the plugin is currently windows only, but due to the fact that both the windows and linux dll's work basically the same it should be possible with a bit of modification to make it work on linux aswell
Yep, was planning to do so.
nice!
I also think that it's a very good thing that I'm sharing the package, since some amazing packages such as uFlex are based of it, so maybe we'll get more awesome physics systems now
ye hopefuly we will get some really nice things with it, one thing im hoping to do is try add temperature based states, so if it is hot then it will become a liquid, and then when cold a solid
unfortunately flex does internally reorder the particle arrays for performance, so im going to have to try set up some way to keep track of particles, which i imagine could be both hard and fun!
flex does have some reserved phase stuff that i could always use to my advantage to track specific particles, but for multiple particles im currently not quite sure what ill do lol, oh well ill figure something out!
also from checking out the plugin's dll interop it is some-what garbage, so im probably gonna see if i can create a better version using clangsharp
The plugin in general kinda sucks, even the performance. I had a chance to compare the performance I got with my own bad PC and a bud's gaming PC and it was really similar. I'd get around 15fps and he'd get only 25fps even though he has a modern PC and I have this shit
how many iterations and substeps are you doing each physics frame?
ill do a performance test sometime soon and compare the plugin to the demo app, to my garbage first attempt from last week of getting flex working with unity
If I remember correctly, both tests had some of the lowest amounts you could get with still remotely good looking results. And also Unity's graphics settings set to low.
try set flex's rendering down (smoothing low, but above 0, and mess around with anisotropy)
But Unity seems to be very very subjective about how it handles performance in different versions
true
you should download and try the flex demo app and see if you get better performance, as then we know it is the plugin or unity having issues
I haven't played around with flex for about a year at this point so I'm not exactly sure if I could even run it now that Unity's newer versions seem to have worse performance.
welp unity atleast as better performance than unreal lol
the one thing i really think need performance improvements would be the particle system though, even with gpu rendering it is still very slow, and cant get more then 10 thousand particles on my computer
ye lol
Damn, that's weird. I got get even to 10 million on mine
Did you try it with a render pipeline your PC can't handle, like hdrp?
goodness, what did you have your settings set to on that particle system?
Everything default. I pumped up the default particle example to 10m
guessing you were using cpu rendering then?
fascinating!
Nope, the actual GPU one. If I'd have it set to CPU I'd have crashed my PC and broken it once again lol
lol, that is cool, your gpu must be better than mine then
This once again shows how subjective Unity is to versions and render pipelines when it comes to performance
ye
You can see it in the pic I sent. It's at least seven years old at this point
oh ye, let me quickly check which gpu i have
GTX 750 ti
How old is it? If it goes over seven-ish, then it's no wonder.
not certain, ill quickly google
same
Ah, no wonder it doesn't work that well. The only reason why mine works is that I've fucked around with my PC's settings and also customized the PC in general a bit. I've basically broken every technological limit it should have, and even rendered a whole realtime 4k scene.
goodness gracious lol, welp congratz!
Also, I'm really happy to finally find someone else with slightly worse hardware 😂
ye it doesnt happen often lol
Have you tried dots yet, btw? I got it to run over 10000+ realtime physics objects in 100fps with the new Unity physics, it's amazing
ye dots is awesome!
Was really awesome to do physics tests with it
ye same lol, i have a whole sphere rigidbody short puzzle game that i use as a testing ground for it, awesome lol
wish nvidia flex was thread safe, as it would be awesome to use dots and flex together for ultimate fluid physics performance lol
Hopefully we'll get there, can't wait for Unity PhysX 5 support
doubt it will come any time soon, the last time i heard there are no physx 5 dll's or anything, instead physx 5 is locked up in nvidia omniverse
but omniverse is trying to work with unity to get them to work together
hopefully it will come soon!
I'd guess it'll take about 1-3 years, but it's sure as hell worth the wait!
ye probably, very exciting lol
physx 5 would be so cool, because it also includes more up to date version of flex and flow, both of which are awesome
although i wouldnt be able to use it though lol, rtx and higher only
Yeah, that's the only bad part of it lol
oh well im sure someone will figure out a way to mod that requirement away
But maybe ya won't even need it once you played around with Flex enough 😏
lol
that is something i do perhaps want to see, which is faster: Flex, Flow, Cataclysm
all of them are nvidia fluid simulation api's from similar times
I wonder if I could create a system that would turn Flex water to Alembic animations for water anim creation inside unity
I might test that
ooh that sounds cool lol!
But yeah, I'll fix the rep once I get out of work, so in a couple of hours.
ok got it!
So I'm making a game with a wall jump mechanic and I want to make a rope that when the player jumps from the wall and goes back onto the wall there is a rope in his hand that moves with him and his hands go up the rope how can I do that. (ps. Tell me if this is the wrong channel because everywhere I looked ropes seem to be in the physics section)
i think so, assuming you are using rigidbodies to simulate clothe physics
what are you using to simulate the clothes physics?
i would reccomend checking out this vid if you haven't already, it is a good introduction to cloth physics in unity https://www.youtube.com/watch?v=Nc_ZMgEFj-A
that is the where, but what is the how, cloth physics? Soft body api of some kind? Rigid body?
I want to make serialized GameObject array(+-50 items of grid and tilemap). Does it cost a lot of performance? Or maybe it is possible to make it in a better way?
an array on its own shouldn't cost performance, only memory, but depending on how you interact with the array i imagine could affect performance in either a positive or a negative way
I want to instantiate a random game object from the array and destroy it after a while.
this should be fine for performance i think, how often do you plan to instantiate?
When first game object reaches x position. And destroy game object in 15 seconds
On start destroy(.., 15f)
that should be fine, on my ancient gtx 750 ti i can instantiate about 2 thousand game objects a second with 50 fps
i wish you luck!
Can anyone recommend resources on character controllers? In particular with regards to UX and gamefeel?
Other than Jasper's work
Hey I'm trying to make a drone balance - it is a simple collection of 4 rigidbodies with individual AddForces to simulate a rotor
thing is I don't know a good way to automatically balance the rotation of the drone. Does anyone know a good method? Currently this is what I have, and it sort of works, but it requires a small amount of power (as it will overshoot), and it takes forever to balance and settle
If you don't find an answer here, you might try on Reddit. This sort of thing might be too niche to find an answer for here, even if you are using unity
You need a PID controller
Thanks, that sounds about right, I'll look into it cheers
when i jump on to this mesh i fall straight through it has a mesh collider but it dosent seem to do anything
Started trying to fix the rep. I'll try to just import the folders into a project before I do anything else.
I think it should just work if I rename the "assets" folder to something else...? And possibly some other small fixes, but that should be it
And of course add instructions for the Editor based stuff
Wait, I imported it into an empty project and didn't get any errors. Lemme try to also import the example scenes. Even the editor files worked.
Oh wait, I already got the samples! 😂
Fuck, it works perfectly! Be it at an awesome fps that is 🤣
I do have to say that I did not expect it to work
Lemme test around to get some screenshots for the rep so it doesn't look like a virus or a scam before updating it lol
Am I using collider on tilemap in the right way?
anyone good with physic calculations for collisions and detections?
@potent notch It should actually work now. Added some instructions and screenshots too.
Now that it actually works again, I think I should make another advertisement 😂
Here's the NVIDIA Flex plugin for Unity available for download for testing and research!
why is my character stuck on a tile and his velocity is 0
Do you ever, in code, set the velocity to zero?
awesome lol!
great job!
You could just animate it in something like Blender, or use Unity cloth physics with a script that adds a physics push to a specific part of the cloth to make it float
I dont see what the physics would be needed for in this case? There doesnt seem to be any collisions between any objects so no actual physics are needed. It can either be handmade animation or procedural animation which deforms the cloth on the fly (you could rig the cloth so it would have few bones in it and then you could procedurally animate using the players position/velocity, the bones current velocity, nearby bones etc.)
I think you might be able to use physics joints for it, but you might have to rely on moving the player using the velocity
might be worth looking at configurable joints instead, perhaps? I don't think spring joints allow rotation
no worries :)
With physics its hard to get the cape swaying in the wind/when she runs. You could probably use vertex shader or c# script to get the cape swaying on top of the physics
Hi everyone, I'm in a bit of a pickle trying to get my physics to work correctly.
I have a player character which i move using forces. I have other object in the level which also have rigidbodies, but I only want some of the to be able to get pushed by my player. Others should block the collision or be able to get pushed indirectly. Any advice?
pretty much. Might be worth looking into something like a water shader for the swaying effect, and then animating or simulating the cape on top of that
i am very confused lol, is there another proper way to add proper movement to a rigidbody without directly setting velocity?
moveposition cancels out addforce which i use for jumping, and using add force for movement gives floaty and unresponsive movement
directly setting velocity means that the object will not be able to be pushed by other objects
Use AddForce but be smarter about how much force you add and when
If you want things less floaty you add more force over a shorter period
Think about how things work in real life
but using add force means that it doesn’t decelerate when letting go of the key
or at least not very fast
It does if your code tells it to
That's why I said be smarter
Apply a braking force if you want
so when the key is let go, for 1 frame apply an opposite force to slow it down?
I didn't say one frame
As much time as you want.
Just don't expect you can write one or two lines of movement code and it will feel good
Player movement is complicated
well i know that
And it takes a lot of tweaking and clever code to make it feel right
I once worked with velocities and moving things. It's not ideal if you want to be pushed, but you can make it so it only applies your velocity when you're pressing the movement keys
I usually just move the transform directly :P
I need some help in my game if someone is available
You can ask a question and if anyone can help, they will. #854851968446365696 if you need a guide on how a proper question is asked.
Alright. The thing is my game has a ship and an outside world, when the ship is moved using Rigidbody2D.velocity all items are launched around the ship. Is it possible to seperate somehow so they're not affected from the outside world? I can change the ship transform.position property to move the ship smoothly without items flying but then collisions don't work with the world tiles.
Movement system by changing transform.position
The most robust way to handle this is use multi-scene physics
basically simulate the physics of the inside of the ship in a different scene, and render them here with proxy objects.
Are rigidbody forces applied all at the same time for a frame? Or in sequence?
Does it matter? I think the overall force just depends on the sum of the forces
I'm using add force at position. So if the rigidbody position changes, the torque direction will change.
Afaik, the position doesnt change, all the forces from the frame are added up and the position is changed only after the (physics) frame. This should be easy to test. If you add force to the center of mass, there should be no rotational acceleration right? If you add lets say 10 forces to the initial middle position (same position for all 10 calls), there should be rotational acceleration if the position changes after each AddForceAtPosition, if the position doesnt change as I think, the rotation should stay fixed
Thanks, I'll try that
nothing changes until after FixedUpdate when the physics simulation runs
Thanks @timid dove
I was testing another script. This one just uses AddRelativeTorque. It seems that after adding relative torque on X and Y, I start getting angularVelocity on Z. Any idea why? Is it because of the format of the Rigidbody colliders?
gimbal lock?
😮 wow
Not sure but I don’t think so. It’s just a small amount of rotation.
Maybe its just some inaccuracy in the calculations
i tried that but it tends to interfere with addforce :/
Good day all. I am attemping to make some gold chain necklaces for an avatar. These need to be physics driven due to dynamic choices of animation that can be played/mixed. So far I am unable to get a necklace of any kind to physically interact with the character let alone a working solution. Could someone offer a tutorial link or any advice on how best to get started with this task? I would be most grateful!
Hello everyone, I have a problem and I need help, when I shoot an arrow onto a box the box keeps moving with arrow
please just google for a second on how to screenshot for whatever os you are using
personally i do a mix of both, but usually i try to get the physics non baked if possible, but im not really a normal person lol
How come adjusting the center of mass to the bottom of an object on a rigidbody does not have it straighten out when it is falling down?
I agree, but it makes the game unplayable and is hard to fix 😦
I have a character controller with Slope Limit and Step Offset to 0, but yet the character is still walking up slopes and stepping on stuff? Any ideas?
Why not rig for cloths?
Whats wrong with that?
Id not make any actual cloth physics, just rig the model so you could easily move parts of the model at once. Using some springs joints and stuff you could connect the rig so it would react to the player movement correctly
sorry for late response but i wasnt home
i dont set it to 0 but i change it
void Update()
{
grounded = IsGrounded();
if (jumpyCooldown > 0 && grounded) jumpyCooldown -= Time.deltaTime;
else if (grounded) { canJump = true; canDoubleJump = true; }
horizontal = Input.GetAxisRaw("Horizontal");
if (Input.GetButton("Jump") && grounded)
{
CoolDownFunction();
if (canJump) rb.velocity = new Vector2(rb.velocity.x, jumpingPower);
}
else if (Input.GetButtonDown("Jump") && !grounded)
{
if (canDoubleJump) { rb.velocity = new Vector2(rb.velocity.x, doubleJumpingPower); canDoubleJump = false; }
}
if (Input.GetButtonUp("Jump") && rb.velocity.y > 0f)
{
rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y * 0.5f);
}
Flip();
}
private void FixedUpdate()
{
rb.velocity = new Vector2(horizontal * speed, rb.velocity.y);
}```
Everyone ignored you lol
yea :/
How do I make a cable
Use a plugin like Obi Rope or build it from connected bodies and hinge joints
Since you never add force and only mess with rb velocity, perhaps the rb gets to sleep ? Not sure, but you could try to set sleeping mode to never
Does scale matter? i.e do objects behave better or worse if they're 25 vs 0.025 or is it all the same to the engine?
i added this
private void Start()
{
rb.sleepMode = RigidbodySleepMode2D.NeverSleep;
}```
it didnt work
Strange, it's still as start awake in the inspector during playmode
It matters. The physics engine is tuned towards "everyday" sized objects. And larger objects of course will appear to fall more slowly due to the Godzilla effect. Also there are floating point precision concerns as well.
this is old pic
Hello, i've a problem, for my VR project i needed to multiply the scale by 10 all the gameObject, but my hands are going through the wall and object, do you have any idea ? I don't have this problem at scale 1..
Is there some problem keeping the real world sizes? Are you trying to do something extremely huge or tiny?
Well you see - virtual objects are not real, and cannot interact with your real hands.
Ok and there is not possibility to make it real at scale 10 ?
what does "real" mean?
scale is not the only factor here - the original size of the obejct matters too
and the "actual" size you want it to be
@timid dove I work with @sudden hinge on this project which involves coins colliding together, and the thing is that we found out that the collisions between this coins works better when the coins are bigger. So we tried to make the whole project in scale 10 but it leeds to other problems, like the hands going through objects when it is ok in scale 1.
- hands going through objects has nothing to do with scale. Make sure your colliders are correct and that everything is actually set up properly for collisions, like moving objects via the physics engine rather than the transforms and the appropriate Rigidbody settings etc.
- If you want accurate collisions for small objects you'll need to probably tweak some of the physics settings and also probably reduce the default physics timestep from 0.02 to something smaller. Additionally check the same things about how objects are moving
- actually, scale seems to matter because if we do the project at scale 1, the hands does not go through walls! (but the coins interacts weyrdly and the framerate drops dramatically). Couldn't the velocity (or force, or ... something else?) change because of the scale?
- the time step is already changed to 0.014 so no problem on this side
- As mentioned it has to do with your colliders and/or how your hands are actually moving
- 0.014 is only about a 25% increase vs the default. But as I mentioned, you may need to play with OTHER physics settings as well such as default contact offsets etc...
- the colliders seems to be ok, they grow with the scale. The movement of the hands should be the problem, but we can not find where to change that.
- we already tried to change other physics settings with no good results
The movement of the hands should be the problem, but we can not find where to change that.
If you're using normal VR hand stuff it's just a 1:1 analog with your hands with no physics interactions. You'd need to create proxy objects that do move via physics if you want them to have physical interactions
We use auto hand. What do you mean in your sentence "You'd need to create proxy objects that do move via physics if you want them to have physical interactions"? (sorry, unity beginner here)
If you use auto hand seems like something you could/should bring up with autohand
Already asked but nobody seems to know! And autohand works with XR, so it might finally be a unity matter
This is an incredibly simple question so I don't know if it even counts as "physics" but:
Should my mesh colliders be boxes or planes?
In the picture the white colliders are currently boxes
but should I remove the back ends to them?
Those pink tiles are supposed to be barrier tiles, so you only encounter them in one direction
Or should I do this instead?
I'm mostly curious what's best practice. Most efficient.
no, the size values seem completely arbitrary to me. I'm building something similar to a pool table
I was just curious if it matters for the game's performance
the ball (equivalent) have a radius of about 0.5 units
I highly doubt it has anything to do with performance, just try it with real world sizing and see how it works, most likely real world sizes gives most realistic results
if having the radius be 5, or 50, would be better, I'd change it sooner rather than later 😄
alright cheers
I've definitely seen scale matter before performance-wise in other engines
Radius of 0.5 is massive, just google the size of aftual pool ball
I know it's a silly example, but scaling a mob in Minecraft would cause extreme lag, and I'm assuming it's because the engine itself handled mesh sizes strangely
but I haven't seen it matter in Unity myself
Thats not unexpected but if you scale the whole world, it shouldnt matter. (Also minecraft uses some voxel based physics for mobs so its not at all the same)
(Also minecraft uses some voxel based physics for mobs so its not at all the same)
righto, thanks for the clarification
is there anything like PhysicsScene.Simulate that simulates animations?
or simply simulates Update() calls?
I believe the Animator has an "Update" method that takes a delta time, you can invoke it every frame to manually update animations, just be sure to disable the animator component
wow that was it, thank you so much.
Hi , anyone with experience in PID controllers? How do you usually go about tuning them? I'm currently using to manage my AI aim to avoid overshoot and I tuned mine my running a training trough a genetic algorithm. It now works perfectly but my issue is as soon as I change some parameters on the AI forces, my tuning goes down the drain
Different AIs have different parameters and also while creating new AIs I will be tweaking the parameters a lot and having to run this genetic algorithm trainings is a bit of a pain in the ass
I'm considering if I should use a Neural Network for this. But if anyone has any tips on how to tweak them I would be glad 🙂
I'm working on a simple character controller, but something I'm not sure on how to handle is after colliding with a wall, I set the actor to the fraction of the vector where the collision occurred (at the position of the wall). However, in the next frame the actor is then "stuck", because the collider cast in the opposite direction seems to hit the wall the actor is next to. I'm not sure what the best way to handle this is
what kind? Rigidbody, kinematic or character controller?
A custom character controller using the DOTS physics
but what are you leveraging? does it have a rigidbody? is it kinematic?
No physics at all, just collider casts and modifying translation
Got it. It's a bit strange because casts usually don't collide with objects they are already colliding at the origin of the cast
I would try to add a small buffer so you don't leave the collider exactly close to wall but a lil bit far from it. Otherwise, drawing some debug meshes can help what's going on
That's what's confusing me, tbh it doesn't even look like the collider is touching the object, but that's hard to tell since the dots visualization isn't great
The circle is the character controller collider (a sphere) and the box on the left is the terrain collider
have you tried adding a buffer to see if that helps?
I have a question on torque application. I'm applying a torque of 42k (Y axis) to a rigidbody with 2500 of mass. According to the AddTorque documentation:
ForceMode.Force: Interprets the input as torque (measured in Newton-metres), and changes the angular velocity by the value of torque * DT / mass. The effect depends on the simulation step length and the mass of the body.)
I should be getting 16.8rads/s of angular acceleration. However, I'm only getting 0.98. Any idea why?
Do you mean adding a small percentage of the negated velocity after moving it to the wall?
I mean like, imagine you collided at 0.8of distance, instead of advancing the collider 0.8, you just advance 0.6
Mass is not the important measure for torque, inertia tensor is
Not sure why the docs would say mass
Anyway I'd you want a specific angular acceleration just use ForceMode.Acceleration and you don't need to do the math.
I replaced by inertia sensor and it works 👍
Reported it to unity
(The documentation error). Seems they copied it from addforce
I spawn a box right above another box. Their Rigidbodies are overlapping, so the spawned box experiences an impulse force (upwards in this case) to resolve the overlapping. What's a good way to prevent such extreme "jump", and instead have the spawned box simply move to the space right above the first box?
One way I can think of is to disable the spawned box, do some math to calculate a better spawn location, move the box there, and re-enable it. But I am having trouble with implementation (specifically with finding a better spawn location). The other way I can think of is to apply an opposite force (opposite to the impulse force, that is) to make the box "jump" way less high.
Is there a simpler approach that I am missing?
spawn it in the right place, you can probe for the separation vector manually before spawning https://docs.unity3d.com/ScriptReference/Physics.ComputePenetration.html
Spawning objects on top of each other is not good idea in PhysX, engines like Havok resolves the collisions differently but PhysX uses high forces to try to get out of the situation where colliders overlap, spawning the objects so they dont overlap is the best idea as Annikki said
Sorry if this is not the correct channel, but I cannot find any other better fitting one. I have a spider model that consists of several parts. Each leg is a part. Each legs bone has a collider and a script set. That script takes the actual object with the mesh (and rigidbody) as a parameter and will apply force to it on a raycast hit. Unfortunately that has no effect at all (but the code is executed). I tried to detach the object (with the leg mesh and rigidbody) from its parent already as I was thinking that might hold it in place. It doesn't change anything though. That being said, the meshes of the parts don't even move with their transform - not even in the scene editor. They just stay in place with the rest of the spiders mesh. I thought disabling the bone might help, but with no success. Does anyone know what I'm doing wrong here?
I also tried destroying CharacterJoint and ConfigurableJoint on start with no success
Hello! I've a question about RigidBody2D::MovePosition() method ; physics generally break even when I do a simple rigidBody.MovePosition(this.transform.position) in OnFixedUpdate handler. As soon as I do it, stuff colliding with my spaceship stop making knockback effects, etc. When I comment out this, physics interactions between objects start to work again. MovePosition cannot be used in conjunction with standard physics?
The thing I want to achieve is to control my entity using purely arcade way but still retain proper physics like knockback when something collides into it, etc. So my idea is to handcraft movement using "fake velocity" and use that with MovePosition to control character.
Wait, why rb.MovePosition(transform.position)? Why would that do anything?
Thats the point, it doesnt even do anything but it still messes up collisions between objects. It looks like the impact when colliding with something is applied for a tiny brief moment but then velocity is reset to zero. And just calling MovePosition does that.
It looks like MovePosition resets velocity to 0/0/0 when called.
Can you make a screen recording of the game?
Here you are @unique cave
Ah so the ship is the one thats kept in place using MovePosition. Because its dynamic, its quite expected that it tries to interact with physics but setting the position using MovePosition tries to counter that behaviour
Id try to use .velocity for better results
Or AddForce for even more realistic movement
The idea behind that is that I wanted to mix player control code with standard RigidBody2D dynamic physics. I wanted to make arcade physics as additional layer on top of standard physics, with simple controls (like pressing left = instant full velocity on the left) and I wanted to combine it with standard physics by calling RigidBody.MovePosition(transform.position + arcadeVelocity);
This way I could have my "arcade velocity" separate from "physics veloctiy" as I wanted to gradually reduce player control when "physics velocity" was > 0, so player control strength would be reduced upon impacts or basically any physics imposed force.
Looks like I'm out of luck here and I'll go with AddForce approach instead. Thank you for your time 🙂
I'll probably just go with solution that is commonly suggested over the internet, that is disabling player input for a half second or so to make sure player won't be able to nullify impacts by inputs. 🙂
When using Physics.CapsuleCast will the Hit.point be the center of the capsule when it hit or the point on the edge of the capsule where it hit?
the latter
if you want the center of the capsule when the hit happened you'd do:
Vector3 centerAtStart = Vector3.Lerp(point1, point2, 0.5f);
Vector3 centerAtEnd = centerAtStart + direction.normalized * hit.distance;```
thinking of adapting a current shooter project thing i have in unity so it works in VR
it uses some maths™️ to simulate real bullets, but hitscan style
so the only part of the bullet that actually "exists" is a tracer kinda thing; a trail renderer
I was thinking of making the arms physically simulated and doing the recoil via rigidbody forces,
Has anyone tried ragdolls with guns before?
Im getting a really, really weird thing with configurable joints. I have two arms, set up identically. And they're both behaving differently
Its not being animated or anything
Its rotation is just completely locked?
im wondering if the source code for add force is known? I'm trying to recreate it for nvidia flex
velocity += (force / mass) * deltaTime;
oh awesome thanks so much! If im doing this in a fixed update should i drop the delta time, or does it not really matter
Maybe do a 101 in physics of motion (Newtonian physics)and this will all become very trivial
lol, maths and physics is not my forte lol, but thanks so much for this all!
This whole game dev thing will be very hard for you then
ye, my love of fluid physics does really not go well with my hate for maths lol
yas, and a whole lot of persistance, i once was planning to go through every single int until i found the right version number for something, then i realised it was written on the github read me....
I guess games are dreams cast in math
lol
Sounds like you have what it takes to be a great engineer. Maybe add some disgust in doing stuff repeatedly
lol, i could never do the 3d modelling stuff though lol
i remember after 2 years of attempting to learn blender i showed someone an attempt at making a dragon, their first reaction was "oh goodness is that a snail with wings?"
😜
lol
modeling is easy. Sculpture is hard.
both are a nightmare for me lol
Does anyone know why my mesh collider isn't working?
not working in what sense? What are you expecting it to do and what is it doing instead?
White (player) falls through green (ground)
how are you moving the player
People must ask this all the time, but is there a reason why my player car is stuttering and jiggling? the code for it is very simple, just a transform vector 3 forward. one line of code. let me film it hold on
Im following a unity learn tutorial and it looks just like his, afaik, but his is smooth
Hey, anyone know if there's a "proper" way to shoot a raycast out of a character with multiple colliders? I set up my character using the ragdoll wizard, thinking that each limb would be considered part of a compound collider, however that doesn't seem to be the case. Shots hit colliders on the way out of the player.
I could use a layer mask, but each character would need its own layer in order to shoot eachother and that seems inefficient.
I've also seen people suggest using RaycastAll, but I'd imagine multiple characters shooting eachother would lead to the game bogging down.
using a layermask is probably your best bet have one layer for the player is not a bad move
or you could offset the beginning point of the raycast in direction of the raycast so that its outside of your own colliders range
Well what would the process for layer management be for multiple characters? If I didn't care about friendly fire, I could have each "Team" on its own layer, but I do want allied characters to be able to hurt eachother.
As for offsetting the raycast origin - I was originally going to have a "realistic" shooting system where shots properly originated from the barrel of your gun. Even had a system to move it out of the way when you got too close to a wall. However, once I layered animations ontop of it it just felt bad, so I reverted to the simpler style of shooting from the player's camera
I could probably get away with having the offset for NPC characters, since navmeshagents won't get too close to walls, but there's always the risk of shooting through objects with an exterior raycast origin.
Raycasts from within a single collider exit without issue by design: Notes: Raycasts will not detect Colliders for which the Raycast origin is inside the Collider. so if that origin goes through a wall, the character can shoot through that wall.
I actually was counting on this, anticipating that multiple colliders on the same character would get treated as a compound collider as mentioned, but that's not the case apparently.
wondering if anyone else using nvidia flex has noticed crashes happen randomly? I literally will create a new scene, and copy every object from another scene into the new one and it will crash on load despite it being essentially the same as the 1st scene, weird
nevermind im an idiot and set my code up very poorly lol
hey,
is it possible to render Plane on both sides ?
yes, create a material that renders on both sides, assign it to the plane
this is hardly physics related tho
there is a trick though, I have a mesh collider on the plane and looks like it only effects the displayed side of the plane, would the material option fix that as well ?
no
You will collide with both sides of the mesh collider on the plane, and changing the material to show both sides of the plane will not affect collisions
Mesh materials do not affect physics at all
I dont know , I put the plane in a horizontal position and I was able to go throught from the invisable side but not from the other ...
ok, so I will try the invisable side again, if it didnt work, I guess I will have to either use a box in stead or a another 1 side plane, right ?
probably
Turns out this was the correct thing to do - move the raycast source (player camera) forward to not hit the colliders but still keep it within the larger collider I'm using for the player's physics. Got it sorted out now.
Turns out there was a sweet spot I could place it in to avoid that issue, and the issue of having the shot source be outside of the player
I have some vr hands
But they go through objects
How can I make a rigidboy that tries to match a coordinate but stops when hitting something
springs perhaps between the 2 rigidbodies, although im not certain if this is a good solution lol
You can use two objects per hand: the actual controller with a kinematic rigidbody on it
and then you have a non-kinematic rigidbody with the hands on it. Connect them via joints (I usually use configurable joints) and set up the drives to be strong enough to keep it near the hand but not enough to pull the hands through walls
Im using a boxcollider 2d to collide with compositecollider2d s but the colllision isnt getting detected, not even in the "contacts" tab under the colliders
this is unusual considering how it worked nice the other day and suddenly stopped working
after i switched a few things around
what could be going wrong?
not exactly physics as both are triggers but i found this to be the closest channel
Hi,
I know mesh collider is expensive, but if I have 10-100 mesh colliders on cubes and spheres with all those objects are set to be "Static" ... would that help with the fps dropping by them ?
- Marking objects as static doesnt help afaik, same AABB tree is used for both dynamic and static objects
- Mesh colliders arent automatically expensive, all collision checks goes through the broad phase check meaning for most objects the actual shape of the collider doesnt matter. So the actual physics overhead is mostly defined by the amount of narrow phase checks and their collider types (https://developer.nvidia.com/gpugems/gpugems3/part-v-physics-simulation/chapter-32-broad-phase-collision-detection-cuda#:~:text=In the broad phase%2C collision,set of pairs of objects.)
- Why mesh colliders for cubes and spheres? Why not using BoxCollider and SphereCollider?
@unique cave thank you for 1 and 2 , they really clear things out.
3 - I'm working on a painting game/app , i need the TextureCoord which is only available with mesh colliders( or at least its way easier to obtain with mesh collider)
I have an animals tail with around 20 bones. I tried both the Character and ConfigurableJoint to get Ragdoll effects on it. My problem is, that any colliders on the bones will make the physics jitter the tail massively. I have tried setting IgnoreCollision and re-enable the Colliders at Start(). Nothing works. Can anyone help me? 😦
Without the colliders the physics work fine
I have an issue where it seems gravity on units are going faster after I exit and return to play mode the first time. This issue doesn't resolve until I restart the editor. This is Unity version 2021.3.9f1 URP.
Any ideas?
You have any video?
That's a lot of joints. Do you have "Enable Collision" turned on in the joint settings?
No, its disabled
Another solution could be creating a layer for all the joints there, and making that layer not collide with itself
I can try that. Thank you. I only need this for ragdoll when an enemy is shot/killed in-air. Otherwise I would have already abandoned it for animations. But with animations, I'd have to move the enemy to the ground manually which doesnt seem attractive either
That's fair enough. Hope it goes well
Unfortunately no success 😦 Still the same behavior
@crude grotto expand that capsule collider component it looks like you have a massive one in place.
I just removed a couple of joints for testing, so please ignore that 🙂
Maybe I can move the colliders into a new Gameobject each and move these into a different non-colliding layer as the joints?
I did try moving them into a layer that does not collide with itself already tho as LunarEclipse suggested
(I moved the Gameobjects as they are now altogether into the layer, not just the colliders in separate Gameobjects)
Can you show the full information of that capsule collider?
Like this? @crude grotto
Theyre all like this one
why is it so tiny???
I guess because the prefab it resides inside is based on a model that is converted "1cm (File) to 0.01m (Unity)". If I create a sphere with the same measurements outside of that prefab, it's a different size than inside of it. Outside its so small its not even visible
*capsule not sphere
Also the Armature has a scaling of 100x100x100
(Which is the root element of those elements with the colliders)
ah thank you
thanks for the info!
After 2 days of rage and despair it turned out that my issue is related to the collider size. If I increase it - even to a point where they keep hitting each other - this buggy behavior is gone. If I then move it into a non-colliding layer its super smooth. Thanks for the help everyone
I wish I knew exactly whats happening so that I don't have to empirically find a working size, but at least I'm a step further
How create a phusic Drag mouse?
That makes sense. If all those joints are pulling towards each other and there is nothing to stop them from pulling them all the way, I can assume that would happen. I think you can adjust springy-ness as well as some of those other factors to give them a bit more central feel.
Anyone have an idea for this issue?
that is weird, have you tried manually assigning gravity with add force?
Those joints are all identical tho - except for their position. They shouldn’t be pulling towards each other then, right? Bounciness and Spring are set to 0. If I interprete the docs correctly, there shouldn’t be any springiness at all, right? Cause obviously there is springiness on the video🤔
Anyone have an idea about this?
Yeah. I'm assigning add force through in play mode, but as soon as I leave play mode, the physics get all wonky next time I enter.
that is indeed odd, usually physics are deterministic, if you then play mode a third time does it do the same as the 2nd or worse or better?
Let me test it now.
The third time might actually be faster?
is faster better or worse lol?
Worse. lol
see how far you can push it, what is the limit of how worse it can get, i do admit that this probably wont help us fix the issue, but it could be fun
Odd thing, whenever I reload script assemblies(save a script) the issues resolves itself temporarily.
weird
Yeah 3rd time around and 4th are getting progressively faster where 4th is about the max speed I'll get.
that is indeed odd, is it the physic frames that are getting faster perhaps?
use a stop watch in your code that prints what time it is at every time a fixed update occurs
then compare the first playmode and the 2nd time
Looks like I got it.
ooh congratz
If I got into editor settings and enter playmode settings to reload on scene and build. It resolves the issue.
ooh good job!!
The questioning helped. Thank you!
no problem, have fun!
Now that the joints on the tail are pretty stable, the leg ones are still going wild and I am out of ideas so I'd like to ask a last time for any ideas before I give up.
I tried all kinds of configurations on the joints and colliders during the last 10 hours. I just can't get them to be stable.
I can reproduce it by creating tiny capsules. At a specific size they just start doing this. I cannot really do anything about that in my model though. Its the actual size ingame with the necessary joints.
As you can see in the video, the joints work okay until I disable kinematic. Workarounds would be appreciated as well 🙂
this looks like physics solver instability. Increasing the physics solver iterations should help reduce the jitter and prevent the wild freakouts. But looking back at your previous posts, I think the tiny collider size w/ massive mesh scaling is making the problem worse. You're essentially scaling it down w/ tiny values and scaling it back up with large scale factors. I suspect the floating point inaccuracies and other rounding errors that introduces is making your physics simulation less stable, though I can't say for sure. If you can scale your model outside of unity so you don't have to import it in a way that requires 100x scale factor I think you'll have an easier time.
https://docs.unity3d.com/Manual/class-PhysicsManager.html
Default Solver Iterations Define how many solver processes Unity runs on every physics frame. Solvers are small physics engine tasks which determine a number of physics interactions, such as the movements of joints or managing contact between overlapping Rigidbody components.
This affects the quality of the solver output and it’s advisable to change the property in case non-default Time.fixedDeltaTime is used, or the configuration is extra demanding. Typically, it’s used to reduce the jitter resulting from joints or contacts.
Default Solver Velocity Iterations Set how many velocity processes a solver performs in each physics frame. The more processes the solver performs, the higher the accuracy of the resulting exit velocity after a Rigidbody bounce. If you experience problems with jointed Rigidbody components or Ragdolls moving too much after collisions, try increasing this value.
Thank you! I’ll look into that. I didn’t create that model myself so I hadn’t questioned it too much - as I’m new to the whole topic. It sure seems strange that my armature has a 100x100x100 scale forcing me to go for such tiny values on the bone colliders
Thanks! As you can see its much better already by simply importing with a scale of 100 and thus reducing all scaling in the transforms to 1. The legs are stable now, just the tail isn't yet
Is that question directed to me?
Im using a boxcollider 2d to collide with compositecollider2d s but the colllision isnt getting detected, not even in the "contacts" tab under the colliders
this is unusual considering how it worked nice the other day and suddenly stopped working
after i switched a few things around
what could be going wrong?
not exactly physics as both are triggers but i found this to be the closest channel
sure you too
There won't be any contacts for triggers
Hi, everyone. I have a game that is built around physics interactions, and I'd like to add multiplayer. As far as I can tell, Unity Physics by default use PhysX which are non-deterministic. Is this correct?
Should I look into switching to havoc before trying to implement multiplayer/client syncing?
how do i make my ragdoll not fall down and stay on its feet ?
You can turn on Enhanced Determinism. Switching to havoc requires switching everything to DOTS and using the entity component system
If you're looking to run a lot of physics objects at a high fps, use the Unity Physics in the DOTS package. You can run up to 1m physics objects in realtime depending on your PC. It's awesome. With the only downside being that you need to use ECS, of course.
I didn't even know enhanced determinism was a thing. That's so simple, thanks!
I have only a few dozen active rigidbodies at any time so I'll try just enabling enhanced determinism.
I'll keep DOTS in mind for future projects, thanks!
Hello, I have noticed in my game that the movement on a better computer is slightly faster and better than on a phone. The problem is that I don’t want this because it’s a mobile speedrun game
How can I prevent this from happening
sounds like you wrote your code in a framerate-dependent way
you need to make it framerate independent
I made the movement inside fixedupdate
This means either:
- Using Time.deltaTime to adjust things
- Using FixedUpdate for movement
show your code
Ok, it’s kinda advanced tho
#854851968446365696 for sharing code here
don't see anything in the Player script that is framerate dependent
ok imma send u another script
https://gdl.space/natowuciqe.cs Check this out, its the colorcolliding script
nothing in here is framerate dependent either
although
maybe this timer script?
What is Stopwatch?
not really seeing anything there either
can you explain or show exactly what you're seeing that's a problem?
Character is moving or jumping faster or something?
maybe it's just looking smoother and that's confusing?
No, it’s like rotating a little bit faster
And the movement also lags way more on mobile then on pc
@timid dove
wdym by "lag"?
after some time, it starts lagging, but maybe it is bc i built it on webgl for mobile id
k
Working on updating character collision from using just one collider to many
Any tips on getting AI to plan around other characters going in and out of range due to their animations?
And also handling collision with "flexible" colliders, like the crocodile's tail. Current plan is to set those to work as triggers only unless intentionally being used by an animation to apply physics
Does swapping a collider back and forth between trigger and not affect the rigidbody center of mass?
Should be easy to test yourself, id guess it doesnt affect the center of mass
make the AI's attacks bigger and more sweeping, but don't make them execute the attacks when the player is right at the edge of the attack's range. Only make the AI execute the attack if it is likely that it'll hit, even if the player backs up somewhat
so do anyone use the unity xr interaction toolkit? has anyone experience slow rotation on setting grabbable objects to velocity tracking?
not necessarily about lagging a frame or 2 behind the actual hands, but more of the rotations are really slow
How to set local variable in VSC?
- What does this have to do with physics?
- Assign variables with the
=operator.
Hello, I hope everyone is doing good ||and I am asking the question under the right channel||
I want to move a tank; and have basic but realistic physics interaction of the track-drive wheel and the ground
My question is; how would I achieve this?
What might be my options?
(And I am completely new to unity and game development in general. You can just point me to what I should be looking for to learn and implement, to achieve what I want to do)
My only experience with unity so far is; Unity pathway's Junior programmer: Up to the Mission checkpoint of the first section: Create with code 1
and me messing about stuff by looking up youtube videos
The interaction of drive wheel with track I have as secondary. Mainly track with ground is what I am looking for (but I do believe if I manage that then the track to drive wheel interaction would be pretty much the same thing, if not easier)
You probably want to look into Articulation Bodies, but I would warn that as someone completely new to unity and game dev this is not a simple project.
Alright, thank you. I know that it won't be simple/straight forward. But I kinda wanna try it out and see how it goes. I was having a hard time looking up the internet because I didn't know what to look for. My searches resulted me in "Drive a car with wheel colliders" sort of area.
Thanks a bunch once again
hey im making a center of mass to my car and i added to it but when i click play my car bounce to the sky
i dont know why
May I have help to make plane physics?
Define "plane physics" and whats the problem with that?
Can I CapsuleCast with a zero distance? If I want to check for collision before I change transform to that position? (So i dont want to check for a clear path from A to B, i just want to make sure that B is clear)
Nvidia omniverse might actually be coming to Unity pretty soon! Really hope that's the case, I'd love to fuck around with an actual newer version of Flex
Just use OverlapCapsule, not CapsuleCast
same lol, although flex 1.2 is still real nice, (although the official unity plugin is garbage lol)
Tbh, I shouldn't be that excited, I can barely run 1.2.0 at 10 fps lmfao
someone know why my car do that?
i was trying to rotate the wheels when the car is moving
i dont know why i did wrong
looks like the pivot of your wheel mesh is way off or something
you should be looking at the gizmos and tool handles etc to see the actual positions of objects and colliders etc..
@timid fulcrum I’d create an empty parent and put it in the middle of the wheel, re attach the script and try again
i will try that thanks
is everthing correct
wait i dont understand
I haven’t even thought about rotating my wheels in my game because it’s very low poly, but if I were to do it I’d animate the wheel rotation and then in the script have it play the rotating wheel animation when I’m using the forward input key (probably w for you?)
you shouldn't be physically rotating any physics objects
you should use WheelCollider
Yes that too
and just use the GetPose stuff from it to rotate and position your wheel which is purely a visual element
you'll have to explain how your hierarchy is set up
which object(s) have which component(s)
etc..
yes sure
wait
in FL i have the collider
and in Wheel LF i have the visual wheel
in all the wheels is how that
if you need something to see tell me
show the visual wheel - and show how you're positioning/rotating it
that's the same image as before
the green is the collider and the blue is the visual wheel
sorry
show with the visual one selected
there's no components on there
no
is this like a skinned mesh renderer?
Notice how your visual wheel's pivot is in the center of the car?
If this is a single rigged mesh, you're going to have to go fix that in Blender
yes idk why
because that's where the bone is on your rigged mesh
you have to fix that in Blender or whatever 3D modelling software
Could he do empty parent?
no
How come?
that's unfortunate
pretty sure that'd only work if it was a separate mesh/MeshRenderer
they can't introduce new bones
it will break the animation
well it's already broken to be fair...
but idk why this isnt working i am seeing a tutorial and is the same
Yeah, if he knows how he could re make it, I just had to do it last night with a door
Did you get the car and the wheels from the tut?
no
Do you have pro builder?
Just make new wheels with pro builder haha, that’s what I’d do atleast
design wheels?
nop
Actually that won’t work either because those wheels are pretty round and I don’t think pro builder has cylinders that high poly count
What I’d do, if you really want to make this work, I’d learn learn blender
i will install it
just select all the vertices for the wheels and there's a way to separate the mesh
you can make it a separate object
and your life will become easier
wait me
You then use this in order to position/rotate the wheels in LateUpdate:
https://docs.unity3d.com/ScriptReference/WheelCollider.GetWorldPose.html
it should intall it fast
I believe in u 🫡
😆
thanks
then it is problem of the model and no of the script
?
2 minutes and i have blender
i have it
i cant put the car on blender
😫
are u there?
What’s the models file type? Sorry I was driving
Once u know the file type then in blender hit file, import, choose the same file type as the car model, and then u should be able to find it in your file explorer
hi, guys, I have an issue with box collision and collision overall.
I have high velocity missile that come from the sky, and when it reach the ground, it explode.
My current issue is that the particle system is spawning inside the ground
there is no offset what so ever on the particle system.