Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by antonsimmerle · Feb 22 at 06:00 PM · game development

Player Jump in air

Hey guys, I am stuck on a problem. I want that a ghost in my game (with a float script so he flys up and down) jumps but lands again in the air. Does someone out there know how to do that?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Caeser_21 · Feb 23 at 01:00 PM

As per I understand, you want him to stay in the air after he flies.
To do this, just set the 'GravityScale' on the ghost's Rigidbody to 0...
Like this alt text


rb.jpg (76.3 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by antonsimmerle · Feb 24 at 10:37 AM

Hey, thanks for the answer. My problem is that when the ghost jumps, he lands on the ground, but I want that he lands in the air. Hope you know how I can do that.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Caeser_21 · Feb 24 at 10:55 AM 0
Share

I didn't couldn't really understand the question...
It would help if you could send an image of the problem.

avatar image antonsimmerle · Feb 24 at 12:30 PM 0
Share

I want, that my ghost after he jumps, doesn’t collide to ground, instead lands on a defined position y position in the air

avatar image Caeser_21 antonsimmerle · Feb 24 at 01:01 PM 0
Share

Send me the floating script, i shall(if possible) change it according to your problem...

avatar image antonsimmerle · Feb 24 at 01:20 PM 0
Share

Here is the Jump script:

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class PlayerJump : MonoBehaviour {

 public Rigidbody rb;


 private void Start()
 {
     rb =  GetComponent<Rigidbody>();
 }


 void Update()
 {
     if(Input.GetButtonDown("Jump"))
 {
 rb.AddForce(new Vector3(0, 5, 0), ForceMode.Impulse);


     }
 }

 }

Here is the floating script:

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class FloatGhost : MonoBehaviour {

 public Vector3 moveDirection;
 public float moveDistance;
 public float moveSpeed;

 private Vector3 startPosition;

 // Start is called before the first frame update
 void Start() {
     startPosition = gameObject.transform.position;


 }

 // Update is called once per frame
 void Update() {
     transform.position=startPosition + moveDirection * (moveDistance*Mathf.Sin(Time.time*moveSpeed));
 }

}

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

133 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

ios development question 2 Answers

How do I pause my countdown Timer,when the door will open? 0 Answers

Using multiple materials on a object 2 Answers

Faster movement speed when FPS is lower? 1 Answer

Raycast through object 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges