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 Haugen · Mar 29, 2014 at 12:34 PM · c#movementsmooth

Smooth movement over seem?

I have a script to generate a world for testing purposes, where I place, (or randomly place), simple cube primitives in a platformer-like way, (creating a 2D game with 3D).

The level I use for testing is a Mario Bros. lvl 1 copy, (it has great elements for testing ). I have a code that uses XY coords, a direction and number of cubes to instantiate in that direction. This works execellently.

My problem is that when my "Player" object moves, and hits a "seem", it does a little "jolt", which looks stupid, but also messes with my movement script. I have trie using other colliders, and I have tried to "soften" the collision detection, but to no avail.

Thanks for the help! Frank

If someone is interested, here's an approximation of my level creation script, (my actual is much more versatile but is copyrighted, by my employer, so I can't share it): using UnityEngine; using System.Collections;

 public class Level : MonoBehaviour {
     //new game objects
     GameObject enviroment;
     GameObject enviromentGroup;
 
     void Start()
     {
         // function to create the predetermened level layout
         // TODO: Allow for variables to trigger the selected level to create
         LoadLevel();
     }
 
     // Method to hold the instruction for creating a level
     public void LoadLevel()
     {
         //Create a parent object for the level
         enviromentGroup = new GameObject("Grouped Enviroment Objects");
 
         // Populate world with cubes
         CreateEnviromentElementCube(-15f, -1f, 25, true);
 
         /* ##### LEVEL BOUNDERIES ##### */
                             // values: X, Y, Amount, Is X-direction?
         CreateEnviromentElementCube(-50f, -50f, 100, true);        // Left Bottom to Right Bottom
         CreateEnviromentElementCube(-50f, -49f, 100, false);    // Left Bottom to Left Top
         CreateEnviromentElementCube(-49f, 50f, 100, true);        // Left Top to Right Top
         CreateEnviromentElementCube(50f, -50f, 100, false);        // Right Top to Right Bottom
     }
 
     // method to instatiate "levelCubes"
     public void CreateEnviromentElementCube(float varPosX1, float varPosY1, int varNumBlocks, bool varBlockDirection)
     {
         // cycle through the given number of blocks in given direction
         for(int i = 0; i< varNumBlocks; i++)
         {
 
             // create cubes in level
             enviroment = GameObject.CreatePrimitive(PrimitiveType.Cube);
             enviroment.name = "Enviroment";
             enviroment.transform.parent = enviromentGroup.transform;
             enviroment.transform.position = new Vector3(varPosX1, varPosY1, 0f);
 
             // add values to iterate one block at desired direction | first block is in the exact given position always
             if (varBlockDirection)        varPosX1 = varPosX1 + 1f;
             if (!varBlockDirection)        varPosY1 = varPosY1 + 1f;
         }
     }
 }
 
Comment
Add comment · Show 2
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 Gruffy · Mar 29, 2014 at 12:51 PM 1
Share

Hey bud, sounds a little bit like your colliders are just off touching as one level end section to your level start section gets instantiated.

This might be as easy as just stretching your box/sphere/whatever colliders you have on the gameobject that is your level floor etc, just stretch your collider(s)(not the transform) approx 0.05 over the edge of your visible mesh. You might find this will indeed, resolve your jolting problem, which could be happening due to your controller discovering a distance between one colliding object and the next.

you could do that in the code, somewhere during your

//create cubes in level part

 environment.transform.boxCollider = new Vector3(1.05f, 1.0f, 0.0f);

giving that extra bit to your x axis in the assignment.

avatar image Haugen · Mar 29, 2014 at 01:52 PM 0
Share

There are some improvement, but even playing around with it, it just don't do it.

I suspect that the physics engine in itself detects a $$anonymous$$uscule difference during rendering, and so it becomes a "bump". I suspect that I might need to "group" a set of cubes and create a collider around them all, or I might repurpose my script to create one elongated "cube", for each group of them :-/

tnx anyways, I'll just soldier on ;-)

0 Replies

· Add your reply
  • Sort: 

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

21 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

Related Questions

How to incorporate Time.deltaTime into existing script 1 Answer

How to smoothen movement of a child object? 1 Answer

How can i drag objects smoothly with touch? Please help me with this code! 1 Answer

A bit shaky when translating 1 Answer

What is the cause of the distorted movement of my character? 0 Answers


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