当前位置:网站首页>地球围绕太阳转
地球围绕太阳转
2022-07-06 09:18:00 【SQ刘】
地球围绕太阳转
新建Unity3D工程,做一些准备工作

1、新建2个3D球体,分别重命名为:Sun,Earth
2、在Project面板中,新建Texture,Material,Scripts文件夹
(1)在Texture文件夹下面,导入贴图素材(百度搜索太阳贴图、地球贴图即可。下面是我百度的素材)

(2)在Material文件夹下面,分别创建2个材质,将它们的Shader着色器更改下,如下图所示
(3)在Scripts文件夹下面,创建C#脚本,双击打开,编写代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class earthAroundSun : MonoBehaviour
{
public Transform sun;
void Update()
{
transform.RotateAround(sun.position, Vector3.up, 1f); //RotateAround是围绕另外一个点旋转
}
}
3、回到Unity3D,将Sun组件拖入Sun中,如下图
4、实现效果图
边栏推荐
- Unity3D基础入门之粒子系统(属性介绍+火焰粒子系统案例制作)
- Fairygui joystick
- Fairygui character status Popup
- 程序设计大作业:教务管理系统(C语言)
- HCIP Day 12
- Special palindromes of daily practice of Blue Bridge Cup
- JS function promotion and declaration promotion of VaR variable
- JUC forkjoin and completable future
- Expected value (EV)
- FairyGUI复选框与进度条的组合使用
猜你喜欢

Unity3D基础入门之粒子系统(属性介绍+火焰粒子系统案例制作)

(一)R语言入门指南——数据分析的第一步

The service robots that have been hyped by capital and the Winter Olympics are not just a flash in the pan

Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)

FairyGUI增益BUFF数值改变的显示

Stm32f1+bc20+mqtt+freertos system is connected to Alibaba cloud to transmit temperature and humidity and control LED lights

Unity场景跳转及退出

FairyGUI复选框与进度条的组合使用

Unity scene jump and exit

Naive Bayesian theory derivation
随机推荐
[899]有序队列
Redis cache update strategy, cache penetration, avalanche, breakdown problems
Guided package method in idea
Latex learning
(五)R语言入门生物信息学——ORF和序列分析
Expected value (EV)
MySQL时间、时区、自动填充0的问题
MySQL占用内存过大解决方案
[leetcode622]设计循环队列
Mysql database index
JS regular expression basic knowledge learning
Office提示您的许可证不是正版弹框解决
Affichage du changement de valeur du Buff de gain de l'interface graphique de défaillance
Database course design: college educational administration management system (including code)
How to add music playback function to Arduino project
About using @controller in gateway
程序设计大作业:教务管理系统(C语言)
Force buckle 1189 Maximum number of "balloons"
Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)
Game 280 weekly