« first day (1 day earlier)      last day (42 days later) » 

12:18 AM
Omg ! I made a code and it pulls it bro !!!!!
i added to wat u told me. I figure to make my objectholder into a child
of the claw when its close
now i just need it to go back to its place
when it lets go
the spring joint wont work it makes it go crazy.
Let me know if you have anything so when it opens , the object holder shoots and also how to get the ball to be with it and shoot the ball please
 
 
3 hours later…
2:55 AM
@Walter. if ( isClosed && objectholder.transform.gameObject.tag == "Player")
{
//colRb.position = transform.position;
objectholder.transform.parent = rb.transform;
}
if(!isClosed)
{
objectholder.transform.parent = null;
colRb.position = transform.position;
}
I made this which grabs the objectholder but when it opens it keeps attached to the claw . and wont go back to its original place like a slingshot . let me know if i need to add or adjust plz
 
 
11 hours later…
2:16 PM
Ok, I will work later today
 
 
3 hours later…
5:02 PM
@Walter ok
 
 
5 hours later…
10:25 PM
@alexa Did just setting position in the code do anything right (*
(disable the rigidbody and speing joints)
 
I disabled true rigid body and spring joint
The*
 
if ( isClosed && objectholder.transform.gameObject.tag == "Player")
{
obj.transform.position = transform.position;
}
 
it grabbed it
with that code
but when it opens , it keeps acting like its child
and doesnt return to its original place
 
yes, but does it keep moving around with the claw?
 
yes
I tried
but it doesnt work
 
10:30 PM
check if in the inspector of the claw, check if isClosed is what it should be (ie. true when closed, false when open)
 
yea i checked and it works
 
can you put a print statement in the if statement i posted above. check if it prints when closed
 
yea I tried that to and i dont get nothing from the console
 
even when it is closed and pulling the object?
 
yup
thats wat im confused
 
10:34 PM
ok, so the tag "Player" should only be on objectholder
 
yes got that
 
the trigger collider on the claw should cover the entire claw
 
yup gpt that
got
 
is there a rigidbody on the claw?
 
no
should i add one ?
 
10:37 PM
you
should add one on either objectholder or claw
 
oh wait i do sorry
claw has but not the objectholder
 
put one on objectholder, just set it to a kinematic rigidbody
 
ok
i got that
 
does it work?
 
no
it still follows it
should i put colRb.position = transform.position; ?
 
10:42 PM
what still follows what? The objectholder should not be a child of anything
you can try that line of codeni
if it works
 
no it doesnt work
it just makes it move away from the claw
the objectholder still follows the claw
 
the objectholder should have no parent
 
private void OnTriggerEnter(Collider objectholder)

{
Rigidbody colRb = objectholder.attachedRigidbody;
if (isClosed && objectholder.transform.gameObject.tag == "Player")
{
// colRb.position = transform.position;
objectholder.transform.parent = rb.transform;
}
if (!isClosed)
{

objectholder.transform.parent = null;

Console.WriteLine("hi hi hih hi");
}

}
}
 
set it to:
private void OnTriggerEnter(Collider objectholder)

{
Rigidbody colRb = objectholder.attachedRigidbody;
if (isClosed && objectholder.transform.gameObject.tag == "Player")
{
colRb.position = transform.position;
}
}
 
that just made the objectholder move by itself and far from the claw
 
10:49 PM
try replacing the line colRb.positon = .... with objectholder.transform.position = transform.position;
 
i changed it and it still moves away from the claw
 
what does your hierarchy look like?
nothing should be a child of anything
 
yea ojectholder is not a child of no one
and claw just has its left and right mesh
 
check the transform position that this script is on. Is the object going there?
does it look like it is going exactky where the claw is, just has an offset? (like it stays a certain position away from the claw)
 
11:04 PM
it stays a certian position away from the claw
 
and check the heirarchy during this. The objectholder should not be a child of anything. (it may change when you hit play)
 
yea nothing changes but now i saw that the object holder and the claw have the same position coordinates
but it shows it moves away from the claw
 
can you post the entire script again please
 
using System;
using System.Drawing;
using UnityEngine;
public class open2close : MonoBehaviour
{
public float speed;
private Animation anim;
[SerializeField] bool isClosed;
Rigidbody rb;

void Start()
{
anim = gameObject.GetComponent<Animation>();

rb = GetComponent<Rigidbody>();
}
void Update()
{
if (Input.GetKey(KeyCode.X))
{
anim.Play("clawopen");
isClosed = false;

}
if (Input.GetKey(KeyCode.Y))
{
anim.Play("clawclose");
isClosed = true;

}
}
private void OnTriggerEnter(Collider objectholder)
 
I mean, this makes no sense because you are setting the position of an object to be at the position of another object.
it could be bevause one of the object's meshes looks like it is where the position is, but it is offset, so the actual position is somewhere else
 
11:19 PM
Im playing with it right now and i notice there is like a white spot that moves when the claw moves I didnt know if that is something
 
can you take a picture and upload it here?
 
it doesnt give me a option to
 
what do you mean
 
like the chat doesnt say if i can upload a picture on this chat
it just says send
 
no "upload" in a grey box next to send?
 
11:23 PM
nope
 
ok, then can you edit your most recent post to add it?
 
ok
1
Q: how to get my clawhand to grab my objectholder?

alexa2 hey guys so i need help please! i need my claw hand to be able to grab my object holder(orange thingy next to the red ball. my objectholder has a spring joint already so I want my clawhand to be able to grab it and pull it with the ball. When my hand opens then it shoots. But when I try to grab...

I send
 
ok, when you click on the objectholder, is the 3 arrows (that show position) in the middle of the objectholder?
 
yes
 
1. can you then put a print statement in the start function of the claw to "Debug.Log(transform.position);" 2. Can you then create a new cube object and set the posirion
to what it debug logged
then, is this at the claw's position?
 
11:29 PM
I think its a light coming from the claw
cux when i move the claw it goes away
but the objectholder doesnt follow it
yea its just a light my bad
 
but can you do what i just posted
 
ok give me a sec
do you want me to write a print statement and add Debug.Log(transform.position);?
or just Debug.Log(transform.position);?
 
second choice
 
what do you mean set the position to what it debug logged?
 
add a new cube and set that position to what is debu glogged
logged
 
11:40 PM
ok
now what ?
this didnt go to the claws position
it didnt even give me a position to be honest. I went to debug on the claw and get that
 
what do you mean. Were the coordinates where the objectholder goes when you grab it (or about)?
 
is the debug have to show me the coordinates on the console?
because it doesnt
 
what does it show?
 
nothing at all
i dont know why
void Start()
{

Debug.Log(transform.position);

anim = gameObject.GetComponent<Animation>();

rb = GetComponent<Rigidbody>();
}
like that right?
 
does it even debug anything?
 
11:53 PM
nope
 
any errors?
 
no
 
can you try just print("test"); to test
 
i did it and i get notjing
nothing
which is very weird
 

« first day (1 day earlier)      last day (42 days later) »