当前位置:网站首页>Unity realizes rotation and Revolution
Unity realizes rotation and Revolution
2022-06-30 04:48:00 【Huangjiale】
Create two sphere, Then create a script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class zhuan : MonoBehaviour
{
/// <summary>
/// This is the object of the sub object revolution
/// </summary>
public Transform m_sphere;
/// <summary>
/// Sub object for rotation
/// </summary>
public Transform m_sphereA;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
// rotation
m_sphereA.Rotate(Vector3.up, Space.Self);
// revolution
m_sphereA.RotateAround(m_sphere.position, m_sphere.up, Time.deltaTime * 50);// This is used to control the speed of rotation
}
}
After creating the script, create an empty object , Drag code in , Then drag the two objects just created for rotation into 

Then run it
边栏推荐
- 【Paper】2019_ Distributed Cooperative Control of a High-speed Train
- Bean创建流程 与 lazy-init 延迟加载机制原理
- Have a heart beating Valentine's day in Singapore
- 【Paper】2020_ Research on defense and evaluation strategy of heterogeneous UAV formation_ Zuojiankai
- What is multimodal interaction?
- Difference between TCP three handshakes and four waves and tcp/udp
- 力扣2049:统计最高分的节点数目
- 0 basic unity course. Bricklaying
- [FPGA] IIC读写EEPROM 的实现
- File system and directory operations
猜你喜欢

The most comprehensive summary notes of redis foundation + advanced project in history

How to repair expired SSL certificates?

Method of applying for code signing certificate by enterprise

Network high concurrency

Geotrustov wildcard

Photon pun refresh hall room list

The golden deer, a scenic spot in London -- a sailing museum that tells vivid sailing stories

Marvel fan welfare: Singapore Madame Tussauds Wax Museum Marvel 4D experience Museum

What to do when the alicloud SSL certificate expires

Intern method of string
随机推荐
Unity is associated with vs. there is a compiler problem when opening
The subsystem implementing transaction persistence in DBMS is ()
IO stream, character read / write, copy
【Paper】2019_ Consensus Control of Multiple AUVs Recovery System Under Switching Topologies and Time D
Process architecture and process management
Intern method of string
[control] multi agent system summary. 4. control agreement.
Unity enables simple music visualization
Keywords implements and @override
Mongodb learning
QT creator 8 beta2 release
One interview question a day the difference between B tree and b+ tree
Malignant bug: 1252 of unit MySQL export
Lambda&Stream
Input / output and interrupt technology -- microcomputer Chapter 6 learning notes
Arrays class
Unreal 4 learning notes - set player birth point
Bean creation process and lazy init delay loading mechanism
HTC vive cosmos development - handle button event
A virtual reality secret room escape adventure, let you see Technology Singapore